Skip to content

fix: repair the mkdocs block pipeline - #30

Merged
slin1237 merged 1 commit into
mainfrom
fix/markdown-block-restoration
Aug 1, 2026
Merged

fix: repair the mkdocs block pipeline#30
slin1237 merged 1 commit into
mainfrom
fix/markdown-block-restoration

Conversation

@slin1237

@slin1237 slin1237 commented Aug 1, 2026

Copy link
Copy Markdown
Member

The markdown-construct audit found the block machinery broken in three independent ways, live-verified before the fix:

  1. Placeholder off-by-oneblockPlaceholder() read docBlocks.length after the caller pushed, so every placeholder resolved to the next block: first block per page dropped, last placeholder empty. (Every prerequisites box site-wide, /smg/reference missing its first grid, /smg/contributing rendering no cards at all.)
  2. Grid regex stopped at the first nested </div> — grids rendered empty; card content flattened into loose prose (91 grids / 270 cards site-wide). Replaced with a balanced-depth scan.
  3. Admonition/collapsible bodies terminated at the first blank line — all 13 ??? question collapsibles empty, orphaned bodies rendering as stray code blocks.

Plus TOC alignment (icon stripping + entity-decoded heading ids fix dead anchors like #what39s-next and literal :material-*: labels), :material-check/close-circle: → ✓/✗ instead of deletion, code-fence info-string attributes no longer break highlighting (yaml title=… highlights as YAML), and ???/???+ variants beyond question.

Verification (production build, wrangler pages dev)

Page Before (live) After
/smg/reference 2 grids, first-block cards missing 3 grids, all cards present
/smg/contributing 0 cards 4 cards
/smg/getting-started/tls prerequisites never rendered; orphan code block 1 prerequisites box, no orphan
/smg/concepts/architecture/high-availability 0 cards 26 cards
/smg/getting-started/logging empty collapsibles bodies render
/smg/concepts/routing/load-balancing :material-*: in TOC, dead anchors clean labels, #cache-aware/#whats-next resolve

Tab-set fix from #27 verified intact (0 literal headings). pnpm lint / check / build clean.

🤖 Generated with Claude Code

Three independent defects made most block-level content render shifted,
empty, or not at all:

- blockPlaceholder read docBlocks.length after the caller had already
  pushed, so every placeholder resolved to the following block: the
  first block on a page was dropped and the last placeholder resolved
  to nothing. Every prerequisites box on the site fell victim to this.
- convertGrid matched the grid body with a lazy regex that stopped at
  the first nested card's closing div, so grids rendered empty and
  card content flattened into loose prose (91 grids, 270 cards).
- The admonition and collapsible body pattern required consecutive
  indented lines, but the content puts blank lines inside bodies, so
  all 13 collapsibles rendered empty and two admonitions truncated;
  the orphaned body text then rendered as stray code blocks.

Also aligned the TOC with the rendered headings (icon shortcodes are
now stripped on the TOC path, and heading ids are slugified from
entity-decoded text, fixing anchors like #what39s-next), mapped
:material-check-circle:/:material-close-circle: to their glyphs
instead of deleting them, took only the first info-string token as the
code-fence language so 'yaml title=…' highlights as YAML, and
generalized collapsibles beyond '??? question'.

Signed-off-by: Simo Lin <25425177+slin1237@users.noreply.github.com>
@slin1237
slin1237 merged commit bb7e557 into main Aug 1, 2026
6 checks passed
@slin1237
slin1237 deleted the fix/markdown-block-restoration branch August 1, 2026 05:50
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.

1 participant