Skip to content

feat(learner): private chapter highlights with notes, Markdown export, and a library - #212

Merged
AQIB-NAWAB merged 4 commits into
mainfrom
feat/chapter-highlights
Nov 17, 2026
Merged

AQIB-NAWAB merged 4 commits into
mainfrom
feat/chapter-highlights

Conversation

@FaisalMisbah23

Copy link
Copy Markdown
Collaborator

Summary

Learners can highlight any passage of a chapter in the web reader, attach a color and an optional note, and see every highlight in one library page. The library can be exported as Markdown.

What changed

Data and API

  • New ChapterHighlight model (per learner, per chapter, with color, quote, prefix, suffix, occurrence, note) and the HighlightColor enum. Migration 20261105121548_add_chapter_highlights.
  • Learner routes: GET/POST /api/v1/chapters/:chapterId/highlights, PATCH/DELETE /api/v1/learner/highlights/:highlightId, and GET /api/v1/learner/highlights for the library.
  • Quotes are limited to 500 characters. An identical quote and occurrence in the same chapter returns 409 HIGHLIGHT_EXISTS.
  • Access uses the existing enrollment gate and release check. Only the owner can edit or delete a highlight (403 otherwise).
  • The chapter reader payload includes the learner's highlights.
  • API tests in server/tests/api/chapter-highlights.test.ts.

Reader (web)

  • Selecting text shows a color toolbar (yellow, green, blue, pink). Creating a highlight wraps the passage in a <mark>.
  • Anchoring uses the quote plus prefix, suffix, and occurrence, resolved against content text only. Buttons, inputs, and the toolbar are excluded, so a selection that crosses a heading never stores UI labels such as "Add a note".
  • Overlapping highlights render per character, with the later highlight winning the color.
  • Clicking a highlight opens a note editor (edit note, change color, delete).
  • A floating "Highlights" panel lists this chapter's highlights and reports any that can no longer be found in the chapter text.

Library (/highlights)

  • Three-pane layout on desktop: courses, chapters, and highlight cards, with color filters and Export Markdown. Course and chapter selects replace the panes on mobile.
  • Nav item "Highlights" in the learner sidebar and mobile bar.

@FaisalMisbah23
FaisalMisbah23 marked this pull request as ready for review November 16, 2026 05:01
FaisalMisbah23 and others added 2 commits November 16, 2026 10:11
…ue index and cap, a11y, library grouping

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@AQIB-NAWAB
AQIB-NAWAB merged commit 8d572a4 into main Nov 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants