@mermaid-wysiwyg/core
v0.1.0
Published
Headless bidirectional editing engine for Mermaid diagrams: lossless CST, semantic graph, ops compiled to minimal text edits.
Maintainers
Readme
@mermaid-wysiwyg/core
Headless bidirectional editing engine for Mermaid diagrams. Text is the source of truth: a lossless CST and per-type semantic graphs turn visual operations (rename, connect, reorder, restyle) into minimal text edits against your actual Mermaid source. Zero DOM dependencies.
import { MermaidWysiwygEditor } from '@mermaid-wysiwyg/core'
const editor = new MermaidWysiwygEditor({ code: 'flowchart TD\n A --> B' })
editor.dispatch({ type: 'renameNode', id: 'A', label: 'Start' })
editor.code // 'flowchart TD\n A[Start] --> B'
editor.undo()Pairs with @mermaid-wysiwyg/dom
(interactive canvas) and @mermaid-wysiwyg/codemirror
(code pane). Docs: github.com/anubra266/mermaid-wysiwyg
