Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): preserve Unicode footnotes across Markdown file chunks #48250

Opensaphid(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/48250/headopened View on GitHub

Problem

In rendered Markdown file previews, Unicode-equivalent footnote labels such as [^ς]/[^σ] and [^ß]/[^ss] resolve when rendered together but stay literal when the reference and definition are split across chunks. The chunker only lowercases labels, so it drops citations that Words recognizes.

Deterministic repro on origin/main (9a08ffb84084c441dcf4a2f595682a44632ecc89)

From a local workspace root, create the fixture:

node --input-type=module <<'JS'
import { writeFileSync } from "node:fs";
const source = `First[^ς] ${"lead ".repeat(900).trimEnd()}

# Second

[^σ]: Greek note`;
writeFileSync("sigma.md", source);
JS

Open sigma.md in Files and choose “Show rendered markdown” if it opens in source mode. The inline file path runs FilePreviewPanel → RenderedMarkdownSurface → splitMarkdown → ChunkedMarkdown, which sends prepared chunks and any shared footnotes to FileMarkdownPreview → ChatMarkdown → Words.

  • Observed: The splitter produces two chunks and no shared footnotes. The first chunk renders literal [^ς], with no reference anchor or trailing note. Words renders a reference and backref when given the same source whole.
  • Expected: Click reference 1 to reach “Greek note”; click its backref to return to reference 1 in the first chunk.

Change

Use one Unicode caseless key for definition capture and deduplication, citation lookup, and backref numbering. Keep dotless ı distinct from ASCII I, as Words does, and preserve authored labels in stubs and references. This fixes inline and streamed file previews in web and desktop; mobile does not consume the shared footnote metadata.

Scope

Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.

Verification

  • Base regression: the single-sigma fixture had no stub (expected undefined to be '[^σ]: .'), and the repeated-citation fixture dropped the first citation. On the fix, vp test run packages/shared/src/markdownChunks.test.ts passed all 111 tests, including sigma and sharp S sharing a number across chunks and dotless ı retaining its own number.
  • vp run check:changed exited 0: format, lint, knip, typecheck (37 packages), and 113 affected tests passed.
  • Before/after Words transcript shows matching anchors and backref routes for sigma and sharp S, distinct notes for dotless ı and ASCII I, and a fixture above the 1 MiB inline read limit. A direct Words probe also linked all 1,585 changed single-code-point labels against their computed keys.
  • Not shown: Interactive browser or Electron clicks, virtualized scrolling, and screenshots. The transcript checks rendered anchors and the production backref routing function, not browser interaction.

Authored by GPT-6.2 Sol (Codex); reviewed by Gemini 4 Neon (Antigravity).

    1. tanstack-source added labelsbug

    2. Approvability

      Verdict: Approved at dc1f3d5

      Macroscope's review found this PR approvable — This aligns Unicode footnote matching across Markdown chunks and back-reference navigation while preserving original labels. The change is localized to document processing and carries no obvious material operational or data risk.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. Explain Change →

      No actionable comments were generated in the recent review.

      Walkthrough

      Footnote label matching now uses a shared key function instead of direct lowercase conversion. The function handles Greek sigma and German sharp-S variants, while keeping dotless ı distinct from ASCII i. Regression tests check matching, duplicate definitions, and citation-to-chunk indexes.

      Changes: Unicode footnote label matching

      Layer / File(s)Summary
      Normalize and match footnote labels
      packages/shared/src/markdownChunks.ts, packages/shared/src/markdownChunks.test.ts
      A shared key function replaces direct lowercase matching when capturing definitions, checking duplicates, matching references, and assigning footnote numbers. Tests cover Greek sigma and German sharp-S variants across chunks, and verify that dotless ı and ASCII I remain distinct.

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix

      Suggested reviewers: stienswout, iamshadmantaqi

      Merge Risk: Minimal · up to dc1f3

      This change makes footnote labels with Unicode case variants match across Markdown preview chunks. It is a narrow fix with added tests, and no merge-blocking risk was found.

      Pre-merge checks: Passed 4

      Check nameStatusExplanation
      Title checkPassedThe title "fix(web): preserve Unicode footnotes across Markdown file chunks" names the main change. The changeset makes footnote label matching Unicode-caseless across chunks (footnoteLabelKey in mark…
      Description checkPassedThe description follows the repository template. It has Problem, Change, Scope, and Verification sections. The Problem section gives the expected behavior and a deterministic reproduction. The Change …
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Full details: Title check

      Explanation

      The title "fix(web): preserve Unicode footnotes across Markdown file chunks" names the main change. The changeset makes footnote label matching Unicode-caseless across chunks (footnoteLabelKey in markdownChunks.ts), and the tests cover Greek sigma and sharp S variants. It follows the conventional commit format and is specific enough for a teammate to understand the primary change.

      Full details: Description check

      Explanation

      The description follows the repository template. It has Problem, Change, Scope, and Verification sections. The Problem section gives the expected behavior and a deterministic reproduction. The Change section explains the single caseless key approach. The Scope section explains why no issue is needed for this small fix. The Verification section lists the focused test run, the check run, and the items not verified (interactive browser clicks, virtualized scrolling, screenshots). The template's optional agent attribution line is present. No required section is missing or empty.

      Finishing Touches

      Generate unit tests (beta)

      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Recent review info

      Run configuration

      Commits

      Reviewing files that changed from the base of the PR and between 7b6a2c96f646830f10183339c2031141dd2801ca and dc1f3d5a38a97393c8423274aeb537abfe98b7f9.

      Files selected for processing: 2

      • packages/shared/src/markdownChunks.test.ts
      • packages/shared/src/markdownChunks.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

Sign in to join this conversation.