Commit 5d8fca0
committed
Replace hand-rolled MarkdownToHTML with goldmark
Replace the ~350-line regex pipeline (convertInline, placeholder
extraction/restoration, line-by-line parser) with goldmark configured
for Trix editor compatibility via three custom components:
- trixTransformer: forces tight lists, converts soft breaks to hard
inside list items and blockquotes, inserts <br> between
blank-line-separated blocks for Trix paragraph spacing
- trixRenderer: compact blockquote output, HTML escaping for raw
HTML blocks (vs <!-- raw HTML omitted -->), TrixBreak and
EscapedAt node rendering
- escapedAtParser: intercepts \@ before goldmark's standard escape
handling to preserve mention-suppression syntax
HTMLToMarkdown gains <br>-aware round-trip support: blockquote and
list handlers now normalize <br> tags before splitting, so multiline
blockquotes and list continuations survive the edit loop
(MarkdownToHTML → HTMLToMarkdown) faithfully. Also fixes multiline
blockquote/paragraph regex matching ((?i) → (?is)) and trims
trailing newlines from code fence content.
Promotes goldmark from indirect to direct dependency (v1.7.13, already
present via glamour).1 parent 4c6860b commit 5d8fca0
3 files changed
Lines changed: 755 additions & 477 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
73 | | - | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| |||
0 commit comments