Repository navigation
v0.2.18
Mermaid source drawn as SVG by the new bezel-mermaid, without gpui, and the document model builds without gpui.
New
bezel-mermaid(mermaid) turns Mermaid source into SVG, a port of Pele 1.6.0:render(source, &Options, &host)answers aDrawing(kind,svg,width,height,links),parse(source, &Options)aParsedwhosemodelserializes as Pele's,render_parsed,detect_typeandsupports. Errors carry Pele's messages, aCode, and the line, column and snippet. The host is aHost, which answers text widths and icon markup;Metricsis one with Arial's advances and no icons.Optionsholds Pele's render options with their defaults. Colours and fonts are--bezel-*CSS variables. It builds without gpui, forwasm32-unknown-unknowntoo. This release drawsinfo,pie,xychart,quadrantChart,radar,sankey,treemap,gitGraph,packet,treeView,mindmap,railroad,venn,ishikawa,gantt,journey,kanban,timeline,classDiagram,flowchart,stateDiagram,erDiagram,requirementDiagram,sequenceDiagram,cynefin,wardley,eventmodeling,C4,architecture,block,agentflow,usecaseandswimlane.mermaid::layoutholds the layered, compound and lane layouts every graph diagram is placed by, andmermaid::svgthe shapes, edge routes, markers and cluster titles they are drawn with;mermaid::diagrams::commonthe tokenizer, label fitting and outline grammar the diagram types share.- On
benches/mermaid.rsagainst Pele 1.6.0 in Node 26, on an Apple M1, every case renders at least as fast as Pele atopt-level = 3, 1.06× to 2.7× (the flowchart docs in 2.1 ms against 3.7 ms); at the release profile'sopt-level = "z"it is 0.70× of Pele on the geometric mean.cargo bench -p bezel-mermaid --bench mermaid, with--profile releasefor the latter, andcrates/mermaid/tests/mermaid/pele/compare.mjsreproduce it. Options::colorstakes aColors(each anRgba) for a renderer without CSS custom properties: the SVG names those colours and every other variable's value in place of eachvar(…), computes itscolor-mix, and keeps rectangles' radii inrx.markdown::fence::fence_noteputs a note under a fence's code,NOTE_SELECTORon it.
Changed
ui::fonts::addhands fonts to gpui's text system and, in a browser, toui::fonts::database, the fonts SVG is laid out and drawn in; natively that is the system's fonts.ui::register_fontsgoes through it.- A
```mermaidfence lays out and rasterizes its diagram withui::fonts::databaseinstead of gpui's SVG renderer, so in a browser its labels are drawn in the app's fonts rather than left out, and natively in the face they were measured in. bezel-syntax-stdis merged intobezel-syntax:syntax_std::installandLANGSaresyntax::grammars::installandsyntax::grammars::LANGS, and therust,python,typescript,json,go,bashandtomlfeatures, on by default, arebezel-syntax's.bezel-canvas-coreis merged intobezel-canvas: its modules arecanvas::change,clip,contain,drag,handle,json_canvas,layout,mindmap,model,paint,pathandsnap.diagram, the read-only painter the mermaid fences used, is gone.bezel-markdown's gpui, theme and ui are behind itsgpuifeature, on by default. Without it the crate isdoc,parse,serialize,select,edit,quoteandsynced, and builds forwasm32-unknown-unknown;Cursor::span, the mark and highlight paints and everything that renders need the feature.bezel-markdown's gpui modules are grouped:fence(wasblock, withfence::highlight,fence::mermaid, andfence_panel,fence_band,fence_noteandNOTE_SELECTORfromrender),paint(paint::comment,paint::find, andpaint::marksfor the mark and highlight paints that were inmarks),app(app::layout,app::link,app::picture,app::previewandapp::typography, besideAppExt),source::style(wassource_style) andrender::selectable(wasselectable). The names re-exported at the crate root are unchanged.markdown::fence::mermaidis the fence alone:Zoom,LANGUAGEandDIAGRAM_SELECTOR. Itsmermaidfeature turns ongpui.- A
```mermaidfence is drawn bybezel-mermaid, every diagram type it draws, painted from its SVG by gpui's SVG renderer at the fence's scale on screen, in the theme's colours. Labels are measured in the system faces that renderer draws them in: the theme's fonts where the system has a regular and a bold face of them, else the first of Helvetica Neue, Segoe UI, Roboto and other common families (Menlo, Consolas … for mono). The first fence drawn loads the system's font list, about a quarter of a second. Source that does not draw shows as code with the error under it. Gone:canvas_core::mermaid,chart::mermaidand theirmermaidfeatures,markdown::charts, and themermaid-rs-rendererdependency.