Repository navigation
fix(shared): Markdown footnotes find definitions inside blockquotes #48485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
juliusmarminge
merged 10 commits into
pingdotgg:main
from
StiensWout:wf/find-f085be312d69e7c56e56287b
Dec 4, 2026
+169
−3
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c96c2cf
test(scenarios): Markdown footnote uses a definition in a later block…
StiensWout 591f210
fix(shared): Markdown footnotes find definitions inside blockquotes
StiensWout eb97fdf
test(shared): cover footnote definitions inside blockquotes
StiensWout 4ae4783
fix(shared): let the parser find footnote definitions inside quotes
StiensWout 50fbb97
test(shared): cover look-alike definitions inside quotes
StiensWout ec9decf
fix(shared): read footnote definitions in quotes and lists as the pre…
StiensWout d87573e
test(shared): cover footnote definitions in lists, quoted math and de…
StiensWout 6c39989
Merge remote-tracking branch 'origin/main' into wf/find-f085be312d69e…
juliusmarminge fc99a95
test(shared): keep the quoted footnote cases that guard distinct beha…
juliusmarminge 031f505
fix(shared): keep a contained footnote's paragraphs after blank lines
juliusmarminge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
scripts/scenarios/markdown-footnote-finds-quoted-definition.e2e.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import { expect } from "e2e"; | ||
|
|
||
| import { test, WEB } from "./t3.ts"; | ||
|
|
||
| test( | ||
| "A Markdown footnote can use a definition in a later blockquote", | ||
| WEB, | ||
| async ({ t3, app, browser, screen }) => { | ||
| const markdown = [ | ||
| "See the source[^source].", | ||
| "", | ||
| "Background paragraph. ".repeat(220), | ||
| "", | ||
| "## Sources", | ||
| "", | ||
| "> [^source]: Quoted source note.", | ||
| "", | ||
| ].join("\n"); | ||
| const project = await t3.project("documentation", { "sources.md": markdown }); | ||
| const thread = await t3.thread({ | ||
| project, | ||
| title: "Source notes", | ||
| messages: ['See :codex-file-citation{path="sources.md"}'], | ||
| }); | ||
| await t3.open(thread); | ||
|
|
||
| await screen.getByRole("button", /^Agent See/).tap(); | ||
| await screen.getByRole("link", /^sources\.md/).tap(); | ||
| await screen.getByRole("button", "Show rendered markdown").tap(); | ||
| await screen.getByText("See the source", { exact: false }).waitFor(); | ||
| await app.screenshot("quoted-footnote-definition"); | ||
| await expect(browser.locator("a[data-footnote-ref]")).toHaveCount(1); | ||
| await expect(browser.locator("section[data-footnotes]")).toContainText("Quoted source note."); | ||
| }, | ||
| ); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oversized container lookahead exports a truncated footnote.
When a blank-separated continuation takes a quoted or list footnote past
SHARED_FOOTNOTES_MAX_CHARS, the lookahead stops before that continuation. Thebreakat line 1128 leavesendbefore the oversized line.charsFromthen measures only the shorter prefix, and that prefix passes the size check. The prefix is parsed, and its definition is shared without the continuation. A reference in another piece can then show a truncated footnote in the shared section. The source chunk still shows the full text.Oversized containers must keep their definitions local, as the comment at line 1112 states. The fix must not export a definition built from a prefix of a container that exceeded the cap. Either route is valid: mark the container as over the cap so it stays local, or evaluate the cap against the full container extent so the existing
charsFromcheck applies.