Skill for using the beautiful-mermaid TypeScript library to render Mermaid diagrams to SVG or ASCII/Unicode, apply themes (including Shiki), and integrate in Node or browser contexts.
3f:T19bc,
Enable fast, themeable Mermaid rendering in Node, browser, or CLI outputs using the beautiful-mermaid package. Use this skill to generate SVG diagrams, ASCII/Unicode diagrams, and consistent theming.
beautiful-mermaid in Node, browser, or CLI tooling.renderMermaidAscii() with useAscii: true for pure ASCII.renderMermaidAscii() default Unicode for box-drawing.renderMermaid() to get SVG and inject into DOM.THEMES['...'] to apply a built-in theme.bg + fg (mono) or add accent/muted/surface.fromShikiTheme().<script> tag.--bg, --fg) without re-render.renderMermaidAscii() + ASCII 兼容import { renderMermaidAscii } from 'beautiful-mermaid'
const ascii = renderMermaidAscii('graph LR; A-->B', { useAscii: true })
renderMermaid() 生成 SVG 字符串import { renderMermaid } from 'beautiful-mermaid'
const svg = await renderMermaid('graph TD; A-->B')
import { renderMermaid } from 'beautiful-mermaid'
const svg = await renderMermaid('sequenceDiagram\nA->>B: ping')
import { renderMermaid, THEMES } from 'beautiful-mermaid'
const svg = await renderMermaid('graph TD; A-->B', THEMES['tokyo-night'])
import { renderMermaid } from 'beautiful-mermaid'
const svg = await renderMermaid('graph TD; A-->B')
import { renderMermaid } from 'beautiful-mermaid'
const svg = await renderMermaid('graph TD; A-->B', { bg: '#0f0f0f', fg: '#e0e0e0' })
import { renderMermaidAscii } from 'beautiful-mermaid'
const unicode = renderMermaidAscii('graph LR; A-->B')
import { getSingletonHighlighter } from 'shiki'
import { renderMermaid, fromShikiTheme } from 'beautiful-mermaid'
const highlighter = await getSingletonHighlighter({ themes: ['vitesse-dark'] })
const colors = fromShikiTheme(highlighter.getTheme('vitesse-dark'))
const svg = await renderMermaid('graph TD; A-->B', colors)
beautiful-mermaid in the target project.renderMermaid() for SVG or renderMermaidAscii() for terminal output.import { renderMermaid, renderMermaidAscii, THEMES } from 'beautiful-mermaid'
const svg = await renderMermaid('graph TD; A-->B', THEMES['tokyo-night'])
const ascii = renderMermaidAscii('graph LR; A-->B', { useAscii: true })
renderMermaid from the package.RenderOptions for colors, font, and transparency.import { renderMermaid } from 'beautiful-mermaid'
const svg = await renderMermaid(`
sequenceDiagram
Alice->>Bob: Hello
`, {
bg: '#1a1b26',
fg: '#a9b1d6',
accent: '#7aa2f7',
transparent: false,
font: 'Inter'
})
renderMermaidAscii.useAscii: true for pure ASCII compatibility.paddingX, paddingY, and boxBorderPadding to tune spacing.import { renderMermaidAscii } from 'beautiful-mermaid'
const unicode = renderMermaidAscii('graph LR; A-->B')
const ascii = renderMermaidAscii('graph LR; A-->B', { useAscii: true })
bg and fg to use mono mode.color-mix().const svg = await renderMermaid('graph TD; A-->B', {
bg: '#0f0f0f',
fg: '#e0e0e0'
})
line, accent, muted, surface, border to override derivations.const svg = await renderMermaid('graph TD; A-->B', {
bg: '#1a1b26',
fg: '#a9b1d6',
accent: '#7aa2f7',
line: '#3d59a1',
muted: '#565f89',
surface: '#292e42',
border: '#3d59a1'
})
THEMES and pass one of the 15 preset themes.import { renderMermaid, THEMES } from 'beautiful-mermaid'
const svg = await renderMermaid('graph TD; A-->B', THEMES['tokyo-night'])
getSingletonHighlighter.fromShikiTheme.renderMermaid.import { getSingletonHighlighter } from 'shiki'
import { renderMermaid, fromShikiTheme } from 'beautiful-mermaid'
const highlighter = await getSingletonHighlighter({
themes: ['vitesse-dark']
})
const colors = fromShikiTheme(highlighter.getTheme('vitesse-dark'))
const svg = await renderMermaid('graph TD; A-->B', colors)
beautifulMermaid.<script src="https://unpkg.com/beautiful-mermaid/dist/beautiful-mermaid.browser.global.js"></script>
<script>
const { renderMermaid, THEMES } = beautifulMermaid
renderMermaid('graph TD; A-->B', THEMES['tokyo-night']).then(svg => {
// use svg
})
</script>
svg.style.setProperty('--bg', '#282a36')
svg.style.setProperty('--fg', '#f8f8f2')
preserveDisplayWidth: true.references/beautiful-mermaid-reference.md.references/api-render.md: renderMermaid 参数表、误区与示例references/api-ascii.md: renderMermaidAscii 参数表、误区与示例references/themes-and-shiki.md: 主题模型、内置主题与 Shiki 集成