Skip to content

fix(markdown): resolve issue #245 formatting parser boundaries - #249

Open
ThisIs-Developer wants to merge 3 commits into
mainfrom
fix/issue-245-formatting-pipeline
Open

fix(markdown): resolve issue #245 formatting parser boundaries#249
ThisIs-Developer wants to merge 3 commits into
mainfrom
fix/issue-245-formatting-pipeline

Conversation

@ThisIs-Developer

@ThisIs-Developer ThisIs-Developer commented Aug 24, 2026

Copy link
Copy Markdown
Owner

What changed

  • replace document-wide footnote and dollar rewrites with grammar-aware Marked extensions
  • keep inline/display TeX atomic and scope legacy \color{name}{content} for MathJax 3
  • de-duplicate heading IDs per render, including segmented worker blocks
  • preserve Unicode letters and combining marks in heading anchors with stable fallback IDs
  • make footnote labels case-insensitive, leave undefined calls literal, generate collision-safe IDs, and link every repeated reference back from the note
  • support multi-term Markdown Extra definition lists without preempting GFM/CommonMark lists, Setext headings, thematic breaks, indented code, reference definitions, tables, fenced code, headings, or HTML
  • route structurally sensitive large documents through full parsing so loose lists, indented code, and multiline HTML comments are not split across worker blocks
  • preserve literal dollars and footnote syntax inside fenced and inline code
  • keep DOMPurify sanitization intact and mirror every renderer change in the packaged desktop app
  • add regression coverage for all 11 reports plus the additional audit findings

Why

Issue #245 exposed a shared architectural cause: document-wide regex preprocessing and naive large-document segmentation could run before Marked established code, math, and block boundaries. The broader audit also found raw ASCII-only slugging and incomplete footnote state management.

Mixed - and * list markers already produced separate GFM lists and required regression coverage rather than a parser change. Definition lists remain the existing Markdown Extra extension; this PR does not add a new Markdown flavor or dependency.

How it was tested

  • npm run check:static — passed
  • final Chromium formatting suite — 12/12 passed
  • affected Firefox/WebKit definition-list checks — 4/4 passed
  • cross-browser formatting audit — every case passed across Chromium, Firefox, and WebKit (one WebKit startup timeout passed immediately in isolation)
  • npm run test:e2e:cross-browser — 12/12 passed
  • complete Chromium run — 153/157 passed initially; three unrelated resource/timing failures passed serially, while the pre-existing tab-close persistence race remains unrelated to renderer files and reproducible in isolation
  • exact 5,796-character shared snapshot tested in Edit, Split, and Preview modes
  • exact Issue 10 expression verified with real MathJax: only the intended terms are colored; operators and delimiters remain uncolored
  • verified unique and Unicode heading targets, repeated footnote back-links, zero MathJax errors, no critical fresh-load console errors, DOMPurify sanitization, syntax checks, and web/desktop renderer parity

Documentation

No user documentation changes are required. The changes restore the reported syntax while preserving GFM, the existing Markdown Extra definition-list extension, standard MathJax 3 behavior, code isolation, and sanitization.

Closes #245

@vercel

vercel Bot commented Aug 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
markdown-viwer Ready Ready Preview Aug 24, 2026 5:38pm

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 24, 2026

Copy link
Copy Markdown

Deploying markdownviewer with  Cloudflare Pages  Cloudflare Pages

Latest commit: fc54b97
Status: ✅  Deploy successful!
Preview URL: https://412b92e4.markdownviewer.pages.dev
Branch Preview URL: https://fix-issue-245-formatting-pip.markdownviewer.pages.dev

View logs

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple Markdown/LaTeX formatting bugs and renderer quirks

1 participant