Skip to content

🔩 Improve footnote Markdown copying and require reviewed OCR - #187

Merged
JFWooten4 merged 6 commits into
mainfrom
john-bull
Oct 16, 2026
Merged

JFWooten4 merged 6 commits into
mainfrom
john-bull

Conversation

@JFWooten4

Copy link
Copy Markdown
Member

Summary

This branch changes two connected parts of the PDF reading/enhancement workflow:

  • More faithful footnotes in copied Markdown. Render footnote references as inline Unicode superscript numbers, place each corresponding [number]: definition directly after the paragraph containing its citation, and preserve bold/italic formatting from the note's PDF text spans. Automatically include an indexed footnote even when the copied selection contains its citation but not the full footnote text.
  • Full image-based OCR review for browser enhancement. Make both native-host light and deep enhancement modes pass --force-ocr --ai-review instead of --skip-text, so even PDFs with an existing (possibly inaccurate) OCR layer are re-read and locally reviewed against page images.

Details

Footnote selection and formatting

  • Factor paragraph boundary handling into startsParagraph and apply it consistently when rendering text and reference markers.
  • Recover full footnote styling from text-layer spans, including unselected portions of a note; use the indexed, OCR-corrected note text for the definition.
  • Associate footnote definitions with the citing paragraph rather than appending all notes after the copied passage; include separately selected notes once without duplicating definitions.
  • Match a reference to its actual highlight region rather than requiring the note's starting pageNumber to equal the reference's page, accommodating indexed regions extending across pages.
  • Preserve the existing plain-text/native-copy guard and page/paragraph boundary behavior.

This builds on the copied-footnote recovery introduced by #183 and its subsequent same-page/page-boundary correction in #184.

Enhancement pipeline

Regression coverage

  • Extend the real SEC petition fixture to cover footnotes 11 and 12, superscript markers, inline definition placement, partially selected paragraphs, selected and unselected note text, duplicate avoidance, and bold/italic formatting.
  • Update native host and CLI tests for the new OCR arguments and mode mapping.

The added tests are present in the branch, but I have not executed them locally in this workflow.

Review considerations

The OCR default is a deliberate cost and fidelity tradeoff: browser enhancement now re-rasterizes every page and runs local AI review, even when an embedded text layer is present. Reviewers should verify runtime/performance and any downstream implications for selectable text and accessibility.

JFWooten4 and others added 4 commits October 16, 2026 10:15
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
JFWooten4 and others added 2 commits October 16, 2026 13:40
Copy only the selected text when the selection consists entirely of footnote content, instead of substituting a numbered recovered definition. Keep full footnotes for selections that contain citing text and add a regression for partial citation footnote copying.

Co-authored-by: Codex Web <noreply@openai.com>
Correct the footnote-label assertion so the test explicitly rejects a copied [12]: prefix rather than a backslash sequence.

Co-authored-by: Codex Web <noreply@openai.com>
@JFWooten4
JFWooten4 merged commit 276afe5 into main Oct 16, 2026
1 check passed
@JFWooten4
JFWooten4 deleted the john-bull branch October 16, 2026 19:35
JFWooten4 added a commit that referenced this pull request Oct 16, 2026
Reconcile clicked-footnote Markdown copying with the selected changes already squashed into main. Preserve styled footnote selection from #187 and keep both #188 and #189 regression tests registered without discarding any prior changes.

Co-authored-by: Codex Web <noreply@openai.com>
JFWooten4 added a commit that referenced this pull request Oct 16, 2026
- 🔩 Copy clicked footnotes as Markdown when enabled
  Copy complete indexed footnote definitions when an inline footnote reference is clicked with Markdown copying enabled. Preserve navigation and existing highlight behavior, leave manual and scrubber navigation unchanged, and add clipboard/error regression tests.
- 🔄 Sync brach to main
  Reconcile clicked-footnote Markdown copying with the selected changes already squashed into main. Preserve styled footnote selection from #187 and keep both #188 and #189 regression tests registered without discarding any prior changes.

---------

Co-authored-by: Codex Web <noreply@openai.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