Skip to content

[Bug]: Footnotes in large Markdown file previews render as literal [^1] since chunked preview #43647

Done

Description

@EricRasputin

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

packages/contracts or packages/shared

Steps to reproduce

  1. Create a Markdown file larger than about 4 KB with a footnote reference near the top and its definition at the end. For example:

    python3 -c "
    p = ['A footnote reference.[^1]', '']
    for i in range(60):
        p += ['Paragraph %d. ' % i + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' * 2, '']
    p += ['[^1]: The footnote text.']
    open('repro.md', 'w').write('\n'.join(p) + '\n')
    "

    (about 7.8 KB)

  2. Open repro.md in the file preview.

Expected behavior

[^1] renders as a footnote reference linked to the footnote at the end of the document, as it did before the chunked preview landed.

Actual behavior

The preview shows the literal text [^1] in the paragraph, and the definition at the end does not render as a footnote. Every footnote in a file longer than one piece breaks the same way, because a document's footnote definitions normally sit at the end while references are spread through the body.

The cause looks like the chunked preview from #40631 (fb4558d). splitMarkdown in packages/shared/src/markdownChunks.ts cuts the file into ~4 KB pieces and copies link reference definitions into every piece, but LINK_DEFINITION excludes footnotes (\[(?!\^)), and the doc comment says "footnotes resolve only inside their own piece". Running the current splitMarkdown on the repro gives 2 pieces: the reference in piece 0, the definition in piece 1, and an empty shared definitions string, so piece 0 has no definition to resolve against.

Impact

Minor bug or occasional failure

Version or commit

0.1.13-nightly.20261125.5258 (desktop). Regressed with #40631; footnotes rendered before.

Environment

macOS 27.2.1, T3 Code (Nightly) desktop app

Workaround

None in the app; files under ~4 KB, or a different Markdown viewer, still show footnotes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions