Repository navigation
fix(shared): Markdown footnotes find definitions inside blockquotes - #48485
StiensWout wants to merge 7 commits into
Conversation
…quote Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Chunked Markdown previews collected footnote definitions only at the start of a line, so a definition inside a blockquote in a later chunk left its reference as literal text. Look past quote markers and end the definition where its quote paragraph ends. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
A quote can hold fences, HTML and indented code, so a quoted line that looks like a definition is checked against the parsed quote instead of a line pattern. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…view does Parse the container with the preview's math syntax so quoted display math stays math, stop at the container's end so a long following block cannot hide a short definition, accept list markers around the quote, and keep the source chunked when nesting is too deep for the parser. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ep quotes Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
| if (lineIndex > containedFootnotesParsedThrough) { | ||
| // Parse this container's lines once; past the cap its definitions stay local. | ||
| let end = lineIndex + 1; | ||
| while ( |
There was a problem hiding this comment.
🟠 High src/markdownChunks.ts:1114
A blank line ends the lookahead for a list footnote, so containedFootnoteEnd excludes valid indented continuation paragraphs and the shared footnote output drops their text. Include blank lines in the parser input and let readContainedFootnotes determine where the definition ends.
🤖 Copy this AI Prompt to have your agent fix this:
In file @packages/shared/src/markdownChunks.ts around line 1114:
A blank line ends the lookahead for a list footnote, so `containedFootnoteEnd` excludes valid indented continuation paragraphs and the shared footnote output drops their text. Include blank lines in the parser input and let `readContainedFootnotes` determine where the definition ends.
ApprovabilityVerdict: Would Approve Macroscope's review found this PR approvable — This extends Markdown preview footnote extraction to blockquotes and lists, with bounded parsing and fallback behavior. The reported continuation-text omission remains subject to the separate correctness blocking gate; no additional material risk was identified. Needs human approval because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
In long Markdown files that are previewed in pieces, a footnote reference showed as literal
[^label]text when its definition was in a blockquote or list item in a later piece (for example> [^source]: Quoted source note.under a Sources heading). The splitter now finds definitions behind quote and list markers by parsing only that container with the preview's own Markdown and math rules, and adds them to the shared footnotes section, so the reference renders as a linked footnote. Look-alike definitions in quoted code, HTML or display math stay plain text, a long block after the container no longer hides a short definition, and quotes nested too deeply for the parser still split and display without linking.Related: #48228, #48065, #48370
Reproduction on main
Commit efbd62a7a7 (main). The opening paragraph shows
[^source]as literal text. Expected: The opening paragraph shows a clickable footnote number linked to the quoted note.sources.mdwithSee the source[^source].## Sourcesheading followed by a blank line and> [^source]: Quoted source note.sources.mdin a local project’s file preview.The cause is at
packages/shared/src/markdownChunks.ts:1062. Ranpnpm scenarios:prove scripts/scenarios/markdown-footnote-finds-quoted-definition.e2e.ts --target webwith the repro scenario added: it failed in 2 of 2 runs on a clean boat.dev VM, withexpect.toHaveCount failedin the output.Evidence
Environment: The web app in Chromium on Linux x64, a fresh checkout on a boat.dev VM reset before each run.
Proven: the repro fails at the test commit c96c2cfc94 and passes on the head d87573e54b, both on main efbd62a7a7.
The opening paragraph shows
[^source]as literal text.The opening paragraph shows a clickable footnote number linked to the quoted note.
Tests
pnpm exec vp run check:changed efbd62a7a700a29ad545f8334b2139407875dab3passed on head.Not in this change
[^label]written inside indented code in a quote is still counted as a footnote reference and gets an extra backlink. This already happens with ordinary top-level definitions and needs separate handling of quoted code.Who did the work
Made in T3 Code by Claude Opus 5.5 and GPT 6.2 Sol