Skip to content

Fix SVG code blocks with blank lines not rendering - #46

Merged
patakuti merged 1 commit into
mainfrom
fix/svg-blank-lines
Apr 12, 2026
Merged

Fix SVG code blocks with blank lines not rendering#46
patakuti merged 1 commit into
mainfrom
fix/svg-blank-lines

Conversation

@patakuti

@patakuti patakuti commented Apr 12, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #45

  • Strip blank lines from SVG content in PreprocessCodeBlocks before embedding as raw HTML
  • Prevents goldmark from splitting the HTML block at blank lines (CommonMark HTML block type 6 terminates at blank lines)
  • Add unit test and end-to-end test for SVG with blank lines

Test plan

  • TestPreprocessCodeBlocks_SVGWithBlankLines — verifies blank lines are removed from output
  • TestConvert_SVGWithBlankLines — verifies SVG survives full goldmark conversion without being escaped
  • Existing SVG/mermaid/plantuml tests pass
  • Manual: render an SVG with blank lines in the browser

🤖 Generated with Claude Code

Blank lines inside SVG content caused goldmark to split the HTML block
(CommonMark HTML block type 6 terminates at blank lines), resulting in
broken SVG rendering. Strip blank lines from SVG content before embedding.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@patakuti
patakuti merged commit 6de9d8d into main Apr 12, 2026
1 check passed
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.

SVG code blocks with blank lines do not render correctly

1 participant