Skip to content

fix(stvisual): private slide-markdown passes through inline <svg> - #311

Merged
skhuang merged 2 commits into
mainfrom
fix/private-slide-svg
May 25, 2026
Merged

fix(stvisual): private slide-markdown passes through inline <svg>#311
skhuang merged 2 commits into
mainfrom
fix/private-slide-svg

Conversation

@skhuang

@skhuang skhuang commented May 25, 2026

Copy link
Copy Markdown
Owner

Summary

Backport of dsvisual ef9f82d / rdvisual #7. Private deck .md files fetched from Drive at runtime go through src/utils/slideMarkdown.js, which was HTML-escaping inline <svg> blocks — turning author-pasted pre-rendered diagrams into literal &lt;svg&gt; text.

Public slides ship inline SVG the same way (mmdc → injected into static HTML), so the slide viewer already styles inline SVG; only the runtime parser was missing the pass-through path.

Changes

  • src/utils/slideMarkdown.js
    • New block handler: line starting with <svg consumes until matching </svg>, emitting verbatim
    • Nested viewport <svg> handled by depth count (rare but legal)
    • isBlockStart recognises <svg so it isn't pulled into a paragraph
  • src/tests/slideMarkdown.test.js — 3 new vitest cases:
    1. Single-line <svg>...</svg> passes through unescaped
    2. Multi-line <svg> block intact, subsequent paragraph still parsed
    3. Nested <svg> balanced by depth count

Test Plan

  • npx vitest run1125/1125 passing locally (21/21 in slideMarkdown.test.js)
  • After merge, verify a private deck containing inline <svg> renders correctly via the cloud drawer

🤖 Generated with Claude Code

Shih-Kun Huang and others added 2 commits May 25, 2026 22:51
Backport of dsvisual ef9f82d / rdvisual #7. Authors paste pre-rendered
SVG (e.g. from mmdc) directly into private deck markdown — but the
runtime parser was HTML-escaping it, turning <svg> into literal
&lt;svg&gt; text. The public slide pipeline ships inline SVG the same
way, so the viewer already styles it.

- Add block handler: line starting with <svg consumes until matching
  </svg>, emitting verbatim. Nested viewport <svg> handled by depth
  count (rare but legal).
- Update isBlockStart so an <svg> line is not pulled into a paragraph.
- Add 3 vitest tests: single-line, multi-line, nested.

1125/1125 tests pass locally.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CI gate (standalone-bundle job) requires src/standalone.js to be
committed in sync with the parser source.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@skhuang
skhuang merged commit 1d5d1a7 into main May 25, 2026
3 checks passed
@skhuang
skhuang deleted the fix/private-slide-svg branch May 25, 2026 15:03
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