Skip to content

🐛 Include adjacent OCR-misread footnote markers in Markdown copy - #200

Merged
JFWooten4 merged 1 commit into
mainfrom
purple-dart
Oct 18, 2026
Merged

JFWooten4 merged 1 commit into
mainfrom
purple-dart

Conversation

@codex-pony

@codex-pony codex-pony Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Fix Markdown copying when a PDF text selection ends at a sentence's punctuation but stops before the immediately following raised footnote marker. In the Securities Transfer Association's August 4, 2009 petition, PDF page 14 (printed page 13) displays note 25 after “self-regulatory organizations.”, while the enhanced text layer extracts the raised marker as 2s. The citation and its recovered note definition can therefore be omitted from the copied passage.

  • Extend superscript detection to short elevated text runs containing s or S, and normalize those characters to 5 when matching an indexed footnote number. This affects citation recognition, not general OCR text.
  • In selectionToMarkdown, include an otherwise unselected superscript when it immediately follows a fully selected span in text-layer order on the same page, only when Markdown copying is enabled and the marker is outside indexed footnote regions. Preserve native copying for untagged plain-text selections.
  • Add an enhanced text-layer fixture for petition PDF page 14 and a regression case covering two selection endpoints. Check that organizations.²⁵ is followed by the recovered [25]: Allowing DTC… definition, which ends with same functions as transfer agents., without leaking 2s or creating an incorrect [5]: note. Also check Markdown-disabled behavior.

This extends the indexed-note recovery introduced in #183 and the Unicode-superscript, paragraph-adjacent footnote output refined in #187. It complements the terminal-punctuation drag-selection fix in #188 by handling the following citation marker during Markdown serialization instead of changing the drag endpoint.

Co-authored-by: Codex <noreply@openai.com>
@JFWooten4
JFWooten4 merged commit b2803eb into main Oct 18, 2026
1 check passed
@JFWooten4
JFWooten4 deleted the purple-dart branch October 18, 2026 09:45
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