mermaid
sublimated renders .mmd and .mermaid files as diagrams. push via git, view the rendered diagram on the web.
- diagrams are rendered server-side on push — no client-side JavaScript needed
- the rendered SVG is stored alongside the source, so viewing is instant
- edit mode uses CodeMirror (same as .ts, .py, etc)
- supported on both sublimated.com (file viewer) and run.sublimated.com (published sites)
- inline comments and reactions work on the rendered diagram (SVG is inline DOM)
demos
one file per diagram type — push them to see them rendered:
- flowchart — nodes, edges, decisions
- sequence — message passing between participants
- class — class hierarchy with methods and properties
- state — state machine with transitions
- er — entity relationship diagram
- gantt — project timeline
- pie — pie chart
- gitgraph — git branch and merge history
- mindmap — hierarchical mind map
styling and themes
all mermaid styling features work — colors, themes, and classes are baked into the SVG at render time.
built-in themes
add a directive at the top of your .mmd file:
%%{init: {'theme': 'dark'}}%%
graph TD
A --> B
available themes: default, dark, forest, neutral, base
custom colors with themeVariables
fine-grained control over 100+ color variables:
%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#e8f5e9', 'lineColor': '#333'}}}%%
common variables: primaryColor, primaryBorderColor, lineColor, background, fontFamily, fontSize. each diagram type has its own variables too (e.g. actorBkg for sequence, sectionBkgColor for gantt).
classDef (reusable classes)
define named styles and apply them to nodes:
classDef green fill:#e8f5e9,stroke:#4caf50
A:::green --> B:::green
inline style (per-node)
style A fill:#e8f5e9,stroke:#333
styled demos
same diagram types with themes, classDef, and custom colors:
- flowchart-styled — classDef + themeVariables + inline style
- sequence-styled — custom actor and note colors
- class-styled — neutral theme
- state-styled — forest theme
- er-styled — dark theme
- gantt-styled — custom section and task colors
- pie-styled — custom pie color palette
- gitgraph-styled — custom branch colors
- mindmap-styled — forest theme
how it works
- push a
.mmdor.mermaidfile via git (or save via edit mode) - sublimated detects the file type and sends it to the mermaid renderer (Selkie, Rust/WASM)
- the rendered SVG is stored in CAS as a
render_svgrepresentation - when you view the file, the SVG is displayed inline
- edit via
~editopens CodeMirror, save triggers re-render - if rendering fails (invalid syntax), the source is shown as highlighted code
embedding in markdown
mermaid code blocks in markdown files are rendered server-side at push time:
```mermaid
graph LR
A --> B
```
uses Selkie (same server-side renderer as standalone .mmd files), not client-side mermaid.js. multiple blocks in one file are batch-rendered in a single call. if a block has invalid syntax, it falls back to a regular code block.
you can also embed standalone .mmd files via content block transclusion — see the markdown mermaid docs.