Skip to content

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

Merged
ThisIs-Developer merged 6 commits into
mainfrom
fix/issue-245-formatting-pipeline
Aug 27, 2026
Merged

ThisIs-Developer merged 6 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

  • replaced document-wide footnote and dollar rewrites with grammar-aware Marked extensions
  • kept inline/display TeX atomic and scoped legacy \color{name}{content} expressions for MathJax 3
  • de-duplicated heading IDs per render, including segmented worker blocks
  • preserved Unicode letters and combining marks in anchors, with stable fallback IDs
  • made footnote labels case-insensitive, undefined calls literal, IDs collision-safe, and repeated references reversible
  • supported multi-term Markdown Extra definition lists without preempting GFM/CommonMark blocks
  • routed structurally sensitive large documents through full parsing
  • added explicit spacing between adjacent list blocks so CommonMark marker changes are visually distinguishable
  • kept fenced and inline code isolated from math, footnotes, and custom inline transforms
  • made GeoJSON, TopoJSON, and STL renderers responsive across Edit, Split, Preview, and pane resizing
  • kept browser and packaged-desktop renderers in parity
  • added targeted automated regression coverage for every confirmed Issue Multiple Markdown/LaTeX formatting bugs and renderer quirks #245 parser boundary

Issue #245 resolution

# Reported case Resolution
1 Duplicate heading IDs Fixed with deterministic per-render de-duplication
2 Mixed - and * bullets Fixed semantically and visually; adjacent lists now have an explicit visible gap
3 Currency dollar signs parsed as math Fixed with grammar-aware tokenization; standard \$ escapes are guaranteed literal
4 Escaped dollars corrupted inside code Fixed by isolating code tokens
5 Footnote syntax leaking from code Fixed with token-aware footnote parsing
6 Multi-term definition lists Fixed while preserving block precedence
7 TeX carets intercepted by superscript Fixed by making math atomic
8 Escaped underscores damaged in math Fixed by preserving TeX source
9 \left\{...\right\} MathJax errors Fixed; verified with zero mjx-merror nodes
10 \color{...}{...} bleeding Fixed with scoped legacy-color normalization
11 Inline/display math mismatch Fixed; verified with matching MathML structure

The full rendering audit also found and fixed a separate lifecycle issue where Leaflet maps and Three.js STL canvases retained Split-pane dimensions after switching to Preview.

Reviewer follow-up: Marked already emitted two semantic

    elements for Issue 2, but the viewer's collapsed 0.4em margins left only a 6.4px gap, making them appear merged. Adjacent list blocks now receive a 1em visual separation. For Issue 3, the exact no-comma example We spent \ which caused \ of loss and . renders as three literal dollars and zero math tokens; unescaped ordinary currency remains supported for compatibility.

    Root cause

    Issue #245 exposed a shared architectural problem: document-wide regex preprocessing and naive large-document segmentation ran before Marked had established code, math, and block boundaries. Heading slug state, footnote state, and rich-renderer resize lifecycles also needed to be scoped to an entire render.

    Definition lists remain the viewer's existing Markdown Extra extension. No new Markdown flavor or large dependency was introduced.

    How it was tested

    • full pre-removal run — static web/desktop parity passed; 160/160 Chromium tests passed (the removed test only loaded the intentionally omitted manual fixture; 159 retained tests remain)

    pm run test:e2e:cross-browser — 12/12 passed across Chromium, Firefox, and WebKit

    • reviewer follow-up cases — 6/6 passed across Chromium, Firefox, and WebKit
    • post-removal static parity check and focused Issue 2/3 Chromium tests — 2/2 passed
    • focused rich-content suite — 14/14 passed
    • timing-sensitive review reload test — 5/5 repeated runs passed
    • exact shared Issue Multiple Markdown/LaTeX formatting bugs and renderer quirks #245 snapshot checked in Edit, Split, and Preview
    • zero MathJax error nodes
    • Issue 10 colors visually and structurally verified as scoped
    • Issue 11 inline/display MathML parity verified
    • maps and STL verified after Split/Preview width changes
    • unique/Unicode anchors and repeated footnote backlinks verified
    • unsafe HTML attributes and URL schemes still removed by DOMPurify
    • no relevant browser console warnings or errors

    Compatibility and security

    • GFM behavior is preserved
    • standard Markdown $ escapes always produce a literal dollar; existing unescaped-currency detection is retained
    • supported Markdown Extra definition lists are preserved
    • code blocks and inline code remain isolated
    • standard MathJax color switches remain unchanged; only the viewer's legacy two-group compatibility form is normalized
    • DOMPurify and the raw-HTML security policy remain intact
    • web and desktop renderer sources remain synchronized

    Final status

    Issue #245 is fully resolved. All confirmed bugs have been fixed, regression tests pass, the supplied snapshot renders correctly, and no relevant regressions were found.

    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 27, 2026 9:22am

@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: 473cece
Status: ✅  Deploy successful!
Preview URL: https://7a2cd657.markdownviewer.pages.dev
Branch Preview URL: https://fix-issue-245-formatting-pip.markdownviewer.pages.dev

View logs

@ThisIs-Developer
ThisIs-Developer merged commit 884cb41 into main Aug 27, 2026
5 checks passed
@ThisIs-Developer
ThisIs-Developer deleted the fix/issue-245-formatting-pipeline branch August 27, 2026 09:25
@ThisIs-Developer ThisIs-Developer added the bug Something is broken or not working as expected. label Oct 2, 2026 — with ChatGPT Codex Connector

This branch was successfully deployed

1 active deployment
Preview — 473cece1 Deployed Aug 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something is broken or not working as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple Markdown/LaTeX formatting bugs and renderer quirks

1 participant