feat: enable mermaid diagram export as SVG/PNG/MMD - #595
Open
xmengnet wants to merge 1 commit into
Open
Conversation
Enable streamdown's built-in download menu for mermaid blocks via controls.mermaid.download, override its labels through the translations prop (chat.markdown.diagram) in both en-US and zh-CN, and scope the mermaid action bar CSS to direct child buttons so the dropdown items keep a visible hover state.
xmengnet
force-pushed
the
feat/mermaid-export
branch
from
August 10, 2026 09:02
55bb5a3 to
1e674e4
Compare
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
Enable exporting mermaid diagrams from chat messages as SVG / PNG / MMD.
streamdownalready ships a built-in download dropdown for diagram blocks(gated by
controls.mermaid.download); this change turns it on, overridesits labels through the
translationsprop using the app's own i18n(
chat.markdown.diagram, en-US + zh-CN), and scopes the mermaid action-barCSS to direct child buttons so the dropdown items keep a visible hover
state.
Change type
Affected areas
Verification
pnpm typecheckpnpm lintpnpm buildand MMD downloads produce valid files (SVG text-editable, PNG 5x
rasterized, MMD source intact); streaming disabled state, fullscreen
and screenshot filtering unaffected.
Screenshots, API examples, or logs
Mermaid block action bar now shows a download button with SVG / PNG / MMD
options (labels localized: 下载图表 / 导出为 SVG / 导出为 PNG / 导出为 MMD).
Configuration, migration, and compatibility notes
No config, env, schema, API contract, or deployment changes. Download
filenames are fixed by the upstream library (
diagram.svg/diagram.png/diagram.mmd).Documentation
Security and privacy
Checklist
.pycfiles,.envfiles, and local storage data are not committed.