Skip to content

Dev/annotation#19

Open
jinchenglee wants to merge 7 commits intokarpathy:masterfrom
jinchenglee:dev/annotation
Open

Dev/annotation#19
jinchenglee wants to merge 7 commits intokarpathy:masterfrom
jinchenglee:dev/annotation

Conversation

@jinchenglee
Copy link

feat: Unified annotation system and sidebar; fix PDF/EPUB scaling and visibility

Backend: annotations.py (models + persistence), server.py CRUD for highlights/notes/chat.
Frontend: right_sidebar.html (Annotations + Chat), refactored chat_component.
Readers: annotation + selection in reader.html (EPUB) and pdf_reader.html (PDF); Ask AI from selection.

Fixes: PDF highlight scaling with zoom (canvas-based coords, highlight-layer sized in JS, renderHighlights in requestAnimationFrame); per-page annotations list (dual-page aware); updateAnnotationContent/reloadAnnotations, edit/delete, go-to-highlight. EPUB multi-node and normalized-whitespace quote matching; per-section list; reloadAnnotations, data-id edit/delete, activateHighlight loads chapter. Sidebar: reloadAnnotations after delete/save; edit/delete via listeners (no inline user text).

Tests: test_annotations.py, test_ui_regression.py (API + UI/regression).

JC Li and others added 7 commits February 11, 2026 12:23
- Add PDF processing via PyMuPDF with metadata extraction
- Add PDF.js-based viewer with HiDPI rendering, zoom, fit-width/fit-page,
  and ToC sidebar populated from PDF outline
- Add AI chat sidebar component (OpenAI/Anthropic/custom provider support)
  with server-side proxy to avoid CORS issues
- Redesign EPUB reader with dark toolbar header, zoom controls,
  fit-width/fit-page, toggleable/resizable ToC sidebar, and proper
  content margins
- Fix EPUB internal link navigation by intercepting content links and
  routing through spineMap lookup
- Move book storage to books/ subdirectory for cleaner repo structure
- Add server shutdown endpoint and stop_server.py utility
- Add new dependencies: pymupdf, httpx, openai, anthropic
- Update README with PDF usage instructions and new directory layout
- Save sidebar width to localStorage on mouseup after drag resize
- Save collapsed/expanded state to localStorage on toggle click
- Restore both width and collapsed state on page load
- Applies to both epub and PDF readers (shared component)
- Add  integration test suite with dynamic EPUB/PDF generation
- Refactor reader.html and pdf_reader.html to use JSON data injection for stability
- Implement persistent chat history backend and frontend logic
- Add dual-page view toggle and logic to PDF reader
- Fix PDF Table of Contents link resolution
- Add partial support for custom LLM provider in server
- Update PDF reader to only capture ArrowLeft/Right when viewer is focused
- Add autofocus to PDF wrapper for immediate keyboard usability
- Preserve ArrowUp/Down default scrolling behavior
… visibility

Backend: annotations.py (models + persistence), server.py CRUD for highlights/notes/chat.
Frontend: right_sidebar.html (Annotations + Chat), refactored chat_component.
Readers: annotation + selection in reader.html (EPUB) and pdf_reader.html (PDF); Ask AI from selection.

Fixes: PDF highlight scaling with zoom (canvas-based coords, highlight-layer sized in JS, renderHighlights in requestAnimationFrame); per-page annotations list (dual-page aware); updateAnnotationContent/reloadAnnotations, edit/delete, go-to-highlight. EPUB multi-node and normalized-whitespace quote matching; per-section list; reloadAnnotations, data-id edit/delete, activateHighlight loads chapter. Sidebar: reloadAnnotations after delete/save; edit/delete via listeners (no inline user text).

Tests: test_annotations.py, test_ui_regression.py (API + UI/regression).
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