ReviewOS

home-lang/home

fix(markdown): align link destination and title validation with Bun

#742
Closed glennmichael123 opened this 9 days ago ·
9 days ago

The current Home Markdown link parser predates several live Bun/CommonMark guards exercised by js/bun/md/md-edge-cases.test.ts.

Confirmed deltas:

  • bare destination parenthesis nesting is unbounded instead of capped at cmark and Bun depth 32
  • angle-bracket destinations accept an unescaped less-than sign
  • parenthesis-delimited titles accept an unescaped opening parenthesis
  • failed inline-link parsing can leave the cursor on a later bracket and incorrectly treat it as an immediately adjacent reference label
  • wiki-link bracket nesting is unbounded instead of capped at 32
  • the lookahead parser must apply the same rules as the renderer so emphasis and nested-link decisions cannot diverge

Scope is to port the live Bun validation in both processLink and tryMatchBracketLink, retain reference fallback, and verify the exact edge-case assertions. Parent: #66

9 days ago

Ported Bun's link destination/title validation limits and parser/lookahead agreement in 85244fc: 32-level bare-destination cap, angle-destination '<'/CR rejection, parenthesized-title validation, reference fallback reset, shortcut adjacency rule, and 32-level wiki bracket cap. Zig AST, formatter, and whitespace checks pass. Fresh native acceptance remains pending under the fixed 3,840 MB safety ceiling.

Sign in to comment on this issue.