Commit baebfbd
fix: derive heading anchors from plain text, not rendered HTML (#314)
The heading() renderer was hashing the already-HTML-rendered heading
content to produce its anchor id. For headings containing inline code,
the syntax highlighter wraps the code in <code><span style="..."> markup,
which then got slugified into anchor ids like
#array-givens-and-code-class-language-malloy-style-...-span-
Walk the Markdown AST to extract plain text first, then slug it. The
displayed heading still uses the full rendered HTML; only the anchor id
and in-page href use the plain-text slug.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 3eb4789 commit baebfbd
1 file changed
Lines changed: 15 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
42 | 56 | | |
43 | 57 | | |
44 | 58 | | |
| |||
202 | 216 | | |
203 | 217 | | |
204 | 218 | | |
205 | | - | |
| 219 | + | |
206 | 220 | | |
207 | 221 | | |
208 | 222 | | |
| |||
0 commit comments