Skip to content

Add chapter detection and navigation dropdown - #15

Open
Ck-Dev786 wants to merge 1 commit into
thomaskolmans:mainfrom
Ck-Dev786:feature/chapter-navigation
Open

Ck-Dev786 wants to merge 1 commit into
thomaskolmans:mainfrom
Ck-Dev786:feature/chapter-navigation

Conversation

@Ck-Dev786

Copy link
Copy Markdown

✨ Add Chapter Navigation Support

This PR introduces chapter-aware navigation to improve usability when reading long documents.

🚀 Features

  • Detects structured section headings (e.g. 1, 1.1)
  • Adds a "Jump to Chapter" dropdown in the header
  • Allows quick navigation to detected sections
  • Automatically updates current chapter during reading

🧠 Implementation Details

  • Added heuristic-based detectChapters() to parse numeric section headings
  • Maps chapters to word indices for navigation
  • Reactive tracking of current chapter based on reading progress
  • Integrated dropdown UI with existing header controls

⚠️ Notes

  • Detection is heuristic-based due to lack of structured metadata in PDFs
  • Works best with structured documents like textbooks and academic PDFs
  • Filtering added to avoid noise (e.g. years, random numbers)

This improves navigation significantly for long documents without affecting existing functionality.
image_2026-03-24_175136620
image_2026-03-24_175226275

Mart1200 added a commit to Mart1200/rsvp-reading that referenced this pull request Sep 26, 2026
Adds a chapter dropdown to the header and shows the current chapter
while paused. Reworked from the original PR:

- Chapters come from the EPUB table of contents (incl. anchors) and
  the PDF outline instead of guessing from numbers in the text
- Pasted text: line-based heading detection ("Chapter 3", "Kapitel IV",
  "Prologue", "2.1 Methods"), skipping years and sentences
- Current chapter now follows the reading position (the original
  reactive statement had no dependencies and only ran once)
- Chapters are stored with the saved session
- EPUB text extraction separates block elements with spaces and skips
  script/style, so headings no longer merge with the next word
- No debug output, no unrelated package-lock changes; with tests

From thomaskolmans#15.

Co-authored-by: Ck-Dev786 <182727623+Ck-Dev786@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant