D2 Standalone

unlisted

by M_Haruki

Render D2 diagrams without installing D2 — fully standalone and cross-platform. Unofficial, not affiliated with Terrastruct.

Updated 1mo agoGPL-3.0
View on GitHub

D2 Standalone

D2 Standalone is an unofficial Obsidian plugin that lets you render D2 diagrams directly in your vault — no D2 installation required, fully cross-platform.
Unlike the official D2 plugin, this plugin uses the official D2 JavaScript library to render diagrams entirely in-process, so it works out of the box on any machine without any additional setup.

Disclaimer: This is an independent, community-made plugin. It is not affiliated with, endorsed by, or supported by Terrastruct, the creators of D2.

This plugin is built using the obsidian-sample-plugin template.

Usage

Write your D2 diagrams in markdown code blocks with the language identifier d2.

MarkdownRendered
markdownrendered

Configuration

If you want to choose a layout engine and other options, add a d2-config block inside your d2 code block in the markdown file.
The example below shows the format.

```d2
vars: {
  d2-config: {
    layout-engine: elk # dagre or elk
    theme-id: 300
    dark-theme-id: 200
    theme-overrides: {
      B1: "#ff0000"
      B2: "#00ff00"
    }
  }
}

a -> b
```

Sketch options can only be configured in the settings.

The TALA layout engine is not supported.

License

This project is licensed under the GNU General Public License v3.0 only (GPL-3.0-only). See the LICENSE file for details.

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.