Repository navigation
Conversation
A fence that opens `d2#show` or `mermaid#show` is a diagram cell. The preview draws it the way it draws an HQL cell: the drawing first, the source behind Code, Edit beside it, and Show in place of Run. A plain `mermaid` fence is a listing. A plain `d2` fence still draws. Mermaid is drawn by merman-cli, a native renderer that needs no browser. It is run the way d2 is: source on stdin, SVG on stdout, within the same 64 KiB, 2 s and 64-entry bounds, delivered as a data: image. It is asked for the resvg-safe pipeline, because Mermaid's default HTML labels do not show inside an image. Both languages are drawn as the source is typed. When the source stops drawing, the cell keeps its last drawing, marked stale, with the reason under it, and Show retries. - ts-core: DIAGRAM_CELL_KINDS, diagramLanguage, diagramEngine, scanDiagramCells; DiagramBlock gains drawnFrom and current, a cell is keyed by position, and IR_VERSION is 5. - vsc-ext: one engine for both renderers, the hyperMarkdown.diagram.mermaidPath setting, the Show Diagram command and code lens, and the showDiagram message. - hmd: MermaidEngine beside D2Engine, and the site build draws mermaid#show and d2#show cells.
HMD-0034 records the renderer choice with its measurements: merman-cli, run with the resvg-safe pipeline under the bounds D2 has. HMD-0030 is amended: a diagram cell is drawn as its source is edited, in both languages, and stale means the edited source does not draw. The rejection of Mermaid as superseded by D2 is reversed in the source sketch, in HMD-0001, and in HMD-0022. The trackers move the rows this branch closes to Done. What remains is recorded as blocked on a toolchain release that pins merman-cli: the extension build, CI and the Pages build, and the public pages.
Every drawing in the preview, in D2 and in Mermaid, has three small buttons at its top right edge: smaller, the current size, which resets it, and larger. A zoomed drawing scrolls inside its own box, and a cell keeps its zoom when its source is edited. examples/diagrams is a vault to test diagram cells by hand: the same picture in both languages, a listing, a Mermaid gallery, and a cell in each state. Open it with npm run example:diagrams. HMD-0034 is accepted, and the Mermaid card moves to doing.
Every platform build of the extension now holds merman-cli 0.11.0, so a Mermaid cell draws on a fresh install. CI and the Pages deploy check merman-cli beside d2, and CI sets MERMAN_BIN so the engine's tests run against the real renderer. The release workflow checks each VSIX for the binary. The Features page draws the same picture in D2 and in Mermaid, and the READMEs and the tools page name Mermaid and its renderer. The three tracker rows that waited on the toolchain release are done.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mermaid becomes a diagram language with the same standing as D2, and both are drawn as diagram cells.
What changes for a user
mermaid#showord2#showis a diagram cell. The preview draws it like an HQL cell: the drawing first, the source behind Code, Edit beside it, and Show in place of Run.mermaidfence is a listing, shown as code. A plaind2fence still draws, so nothing written before this stops drawing.The renderer
Mermaid is drawn by
merman-cli0.11.0, a native renderer with no browser and no Node runtime. It is run the wayd2is: source on stdin, SVG on stdout, delivered as adata:image.Measured on macOS arm64 with six diagram types:
resvg-safe; the default usesforeignObject, which an image does not showIt is pinned through toolchain 0.7.0, which carries it for all five platforms. The toolchain's release check ran it on each platform. Every platform build of the extension bundles it, and each build is about 26 MiB larger. On Linux the bundled renderer needs glibc 2.35 or later.
By tool
@hypermarkdown/core:DIAGRAM_CELL_KINDS,diagramLanguage,diagramEngine,isDiagramCell,scanDiagramCells.DiagramBlockgainsdrawnFromandcurrent, a cell is keyed by position, andIR_VERSIONis 5.hyperMarkdown.diagram.mermaidPath; the command and code lens Show Diagram; theshowDiagrammessage, validated like every inbound message; zoom; andexamples/diagrams, opened withnpm run example:diagrams.hmd:MermaidEnginebesideD2Engineon one base class; the MkDocs plugin drawsmermaid#showandd2#show.merman-cli --versionbesided2 --version; CI setsMERMAN_BIN; the release workflow checks each VSIX for the binary.Still open
d2fence into a listing. It waits on HQL writingd2#showfor a graph.mermaidformat step writes a plainmermaidfence, so the output of that step is a listing until HQL writesmermaid#show.Both are rows in the trackers.
Tests
npm testwithHQL_BINandMERMAN_BINset: 306 tests in the core and 197 in the extension, none skipped.uv run python -m pytestwith the pinned toolchain onPATH: 933 pass, none skipped.uv run hmd lint --root doc --strictis clean, anduv run mkdocs build --strictbuilds and draws the Mermaid example.