Wilmar Rojas Avendaño341 downloadsRender dbml code blocks as interactive entity-relationship diagrams with dbdiagram.io-style orthogonal routing.
Obsidian plugin that renders ```dbml code blocks as interactive entity-relationship diagrams, with orthogonal, dbdiagram.io-style routing (right-angle lines), crow's-foot notation (crow's foot / bar) and direct editing on the canvas.
dbml-erdYou write a ```dbml block with your tables and relationships and the plugin draws it as an SVG ERD, with automatic layout, cardinality markers and interactive editing. Every change you make from the diagram (rename, move, color, cardinality, delete…) is written back into the note's own dbml block — the block is the single source of truth.
dbml / DBML blocks to an SVG ERD.elk.layered) that minimizes crossings.│) if the FK is not null, or a circle (○) if it is nullable.NN badge for not null columns.+ / − / ⊡ (fit) buttons.Everything is saved back to the dbml block:
table.col references).+ handle in the middle of a segment.The interface (menus, dialogs and notices) is available in English (default) and Spanish. Switch it under Settings → Community plugins → DBML ER Diagrams → Language.
Insert a code block with the dbml language:
```dbml
// height: 600
Table contract {
contract_id int [pk]
contract_name varchar(120) [not null]
client_id int [not null]
status varchar(20)
}
Table client {
client_id int [pk]
name varchar(100) [not null]
}
Ref: contract.client_id > client.client_id
```
Table name { ... } (and the short form name { ... }).name type [pk, not null, note: '...', ref: > other.col].Ref: a.col > b.col line, inline ref: > b.col, or the direct form a.col <> b.col.> (many→one), < (one→many), <> (many↔many), - (one↔one).Table name [headercolor: #2E7D32] { ... }.Note: '...', note: '...').// height: N directive (canvas height in px).// comments.A deliberate subset of DBML, enough for controlled schemas. It does not yet include enums, table groups or composite keys.
The plugin stores the visual state as comments inside the block; you don't need to edit them by hand:
// @pos <table> <x> <y> — position of a moved table.// @view <x> <y> <zoom> — pan and zoom.// @size <w> <h> — canvas size.// @edge <from> <fromCol> <to> <toCol> <x1> <y1> … — vertices of a hand-edited route.sql-to-dbml skill)So you don't have to write the DBML by hand there is a Claude Code skill, sql-to-dbml, that converts SQL CREATE TABLE scripts (generic ANSI) — or tables you define during the conversation — into DBML compatible with this plugin (it degrades to what the plugin draws, never emitting syntax it can't understand).
Paste the resulting block into a note inside ```dbml and the plugin renders it.
main.js, manifest.json and styles.css from the latest release.<vault>/.obsidian/plugins/dbml-erd/.npm install
npm run dev # build with inline sourcemaps
npm run build # minified production build
Code structure:
src/main.ts — plugin, block rendering and the Diagram class (SVG, interaction, persistence).src/parser.ts — DBML parser (subset) and block mutators (rename, types, cardinality, delete).src/layout.ts — layout with elkjs and geometry constants.src/i18n.ts — interface strings (English/Spanish) and the t() lookup.styles.css — styles integrated with Obsidian's theme variables.Releases are produced with GitHub Actions (.github/workflows/release.yml).
To publish a new version: bump version in manifest.json and package.json,
add the entry to versions.json and CHANGELOG.md, create a tag with that exact
number (no v prefix) and push it:
# use the exact number from the manifest, without the v prefix
git tag 0.1.19
git push origin 0.1.19
The workflow compiles and attaches main.js, manifest.json and styles.css to the release.
MIT © 2026 Wilmar Rojas Avendaño