fix(stvisual): private slide-markdown passes through inline <svg> - #311
Merged
Conversation
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 <svg> 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backport of dsvisual ef9f82d / rdvisual #7. Private deck
.mdfiles fetched from Drive at runtime go throughsrc/utils/slideMarkdown.js, which was HTML-escaping inline<svg>blocks — turning author-pasted pre-rendered diagrams into literal<svg>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<svgconsumes until matching</svg>, emitting verbatim<svg>handled by depth count (rare but legal)isBlockStartrecognises<svgso it isn't pulled into a paragraphsrc/tests/slideMarkdown.test.js— 3 new vitest cases:<svg>...</svg>passes through unescaped<svg>block intact, subsequent paragraph still parsed<svg>balanced by depth countTest Plan
npx vitest run— 1125/1125 passing locally (21/21 inslideMarkdown.test.js)<svg>renders correctly via the cloud drawer🤖 Generated with Claude Code