smolblackhole134 downloadsRe-enables the ELK (Eclipse Layout Kernel) renderer for Mermaid diagrams.
Re-enables the ELK (Eclipse Layout Kernel) renderer for Mermaid diagrams in Obsidian.
If you ever looked at a Mermaid graph and thought, "this could use more layout engine and slightly more chaos," this plugin is for you.
@mermaid-js/layout-elk.%% elk %% is present, unless you explicitly route all diagrams through ELK.theme: neutral or look: handDrawn still work.[!important] Bundled Mermaid 11 loads a newer Mermaid version If you enable Use bundled Mermaid 11, this plugin loads Mermaid
11.15.0from the plugin itself instead of Obsidian's older bundled Mermaid. This is the switch to flip if examples from the official Mermaid docs work there but not in stock Obsidian. Official Mermaid docs: Mermaid introduction [!tip] Start simple In most cases you only need one thing: add%% elk %%to the diagram you want to route through ELK.[!question] Need more control later? Check the advanced settings guide in docs/advanced-settings.md.
main.js, manifest.json, and styles.css from the release.mermaid-elk-renderer.Add %% elk %% near the top of any Mermaid block:
```mermaid
%% elk %%
flowchart LR
A[Start] --> B[Analyze]
B --> C[Done]
```
That is enough to get ELK layout on that diagram.
[!info] Why these are images The diagrams below are prerendered SVGs. The raw Mermaid source only works live when the plugin is enabled, Use bundled Mermaid 11 is on, and the
%% elk %%marker routes the diagram through the plugin.
```mermaid
---
config:
look: handDrawn
theme: neutral
---
%% elk %%
flowchart LR
Draft["1. Draft"] --> Review["2. Review"]
Review --> Ship["3. Ship"]
```
```mermaid
%% elk %%
xychart-beta
title "Feature requests"
x-axis [Q1, Q2, Q3, Q4]
y-axis "Count" 0 --> 12
bar [3, 7, 10, 8]
line [2, 5, 9, 11]
```
```mermaid
%% elk %%
architecture-beta
group app(cloud)[App]
service web(server)[Web] in app
service db(database)[DB] in app
service disk(disk)[Assets] in app
web:R -- L:db
disk:T -- B:web
```
[!example] Want more than the tiny version? Open the Mermaid 11 showcase page in docs/mermaid-11-examples.md.
[!tip] Use per-diagram routing first Keep
Apply elk to all diagramsoff until you know you want ELK everywhere. [!example] Mermaid config is preserved Existing frontmatter such aslook: handDrawnortheme: neutralstays intact when the plugin injectslayout: "elk". [!warning] Restart note The plugin tries to rerender previews immediately after changes. A full Obsidian restart is still the cleanest reset after changing plugin settings. This is a limitation of how Mermaid and Obsidian's rendering pipeline work.
Open Settings -> Community plugins -> Mermaid ELK Renderer.
The most important options are:
1. Step from being interpreted as Markdown lists by Mermaid.config.layout value with elk.11.15.0 instead of Obsidian's Mermaid.[!tip] Looking for newer Mermaid features? Turn on Use bundled Mermaid 11. That makes the plugin load the newer Mermaid runtime from the plugin and is the option most people want when they are following the official Mermaid docs. Docs: mermaid.js.org/intro [!danger] Danger zone The regex overrides are for real edge cases. If your diagrams already render correctly, leave that section alone and enjoy your day. If they do not, open an issue: github.com/SmolBlackHole/mermaid-elk-renderer/issues
If you want the full Mermaid feature set, syntax, and examples, start here: