obsidianmd /pele
Renders Mermaid diagrams faster than you'd run from a volcano! 🌋
★ 4,436⑂ 136👁 8⑃ 64● 74▤ 22◈ 0
4,436
stars
+31
136
forks
8
watchers
64
prs
74
issues
22
releases
0
discussions
README
Pele
Pele renders Mermaid diagrams to SVG. It is small, synchronous, has no runtime dependencies, and uses CSS variables for colors and fonts.
Pele supports every diagram type built into Mermaid 12.1.0.
Documentation, examples, and a playground are at pele.run.
Install
sh
npm install pele
Or load it from a CDN:
html
for (const el of document.querySelectorAll('pre.mermaid')) pele.mount(el, el.textContent);
Use
ts
import { render } from 'pele';
const { svg } = render(flowchart LR
A[Mermaid text] -- B[SVG]);
document.querySelector('diagram').innerHTML = svg;
In a browser, mount() renders into an element, reads fonts from CSS, and adapts the layout to the container width:
ts
import { mount } from 'pele';
mount(document.querySelector('diagram'), text);
See the API for options and error handling.
The main entry point includes every diagram type. Reduce the initial bundle size by registering individual types or loading them on demand:
ts
import { register, render } from 'pele/core';
import flowchart from 'pele/diagrams/flowchart';
register(flowchart);
ts
import { renderAsync } from 'pele/lazy';
const { svg } = await renderAsync(text);
Theme
Set CSS variables on the diagram or a parent element to customize colors and fonts:
css
.pele {
--pele-bg: fffcf0;
--pele-fg: 100f0f;
--pele-muted: 6f6e69;
--pele-line: 100f0f;
--pele-surface: f2f0e5;
--pele-surface-alt: e6e4d9;
--pele-border: cecdc3;
--pele-accent: 205ea6;
--pele-font: sans-serif;
--pele-radius: 4px;
}
Charts use --pele-series-1 through --pele-series-8. Colors adapt to theme changes without being re-rendered. See Theming for all variables, fonts, and class names.
Security
Pele escapes diagram text, filters links and styles, and limits source and output size. See Security for handling untrusted diagrams, displaying errors, and supplying icons.
Compatibility
Pele targets Mermaid 12.1.0 syntax, with its own layout and visual style. Its parsers are tested against Mermaid's parser specs and with differential fuzzing.
Develop
sh
npm install
npm test
npm run build
npm run bench
npm run bench:mermaid times Pele and Mermaid.js in headless Chrome on the same diagrams and compares bundle sizes. It needs Node 22 or later. It fetches Mermaid 12.1.0 from unpkg; pass -- --mermaid for another release, and set CHROME if Chrome is not in /Applications.
The documentation site and playground are in website/ and use Node 24 and pnpm 12. With nvm:
sh
cd website
nvm use
pnpm install
pnpm dev
After installing the website dependencies, run npm run test:website from the repository root to check the playground.
See Contributing for parser testing.
License
MIT. The specs under tests/compat and the grammar files beside them come from Mermaid, which is also MIT licensed.Top issues
#132Zoom: on touch, a zoomed drawing stops the page from scrolling2 comments · 2026-11-06#121Pele regression: Gantt charts no longer use full note width1 comments · 2026-11-03#114Background color used for text1 comments · 2026-10-31#138Architecture: edge passes through an unconnected service0 comments · 2026-11-08#131Zoom: keyboard focus is lost when Reset or Zoom out ends its own job0 comments · 2026-11-06#130Zoom: links in a zoomed drawing do not open0 comments · 2026-11-06#128Edge to enclosing subgraph is hard to understand0 comments · 2026-11-05#124Emoji are measured too narrow without a canvas0 comments · 2026-11-03
Latest release
1.13.0 1.13.0 2026-10-31- Series colors follow Mermaid's palette theme variables: pie1–pie8 in pie charts, git0–git7 in git graphs, cScale0–cScale7 in timelines, radar charts and treemaps, cScale1–cScale8 in mindmaps, venn1–venn8 in Venn diagrams, and the first eight colors of xyChart.plotColorPalette in XY charts. Shorter Venn and XY palettes repeat. Values that aren't colors keep the theme's color. 55 98 - Labels on palette colors in pie charts, git graphs, timelines and treemaps use whichever of --pele-fg-on-light and --pele-fg-on-dark contrasts more. - Edges that cross a subgraph's border bend less near the nod
News & coverage (3)
Hacker NewsShow HN: Edna, note taking app for developers▲ 331 · 91 comments · 2024-07-01GIGAZINEObsidian creator kepano has released 'Pele,' a lightweight open-source library that uses CSS for theme settings and renders Mermaid diagrams as SVGs.2026-10-207NEWSRoy Keane roasted for denouncing Brazil’s ‘disrespectful’ celebration against Korea at FIFA World Cup 20222022-12-05