Mermaid diagram renderer for MoonBit (ASCII and SVG output)
Dependencies
# Native binary (Linux x64, macOS arm64)
curl -fsSL https://raw.githubusercontent.com/mizchi/moomaid/main/install.sh | sh
# npm
npx moomaid -h
# MoonBit CLI tool
moon install mizchi/moomaid/cmd/moomaid
# MoonBit library
moon add mizchi/moomaid# Render from file
moomaid diagram.mmd
moomaid --svg diagram.mmd
# Render from stdin
echo 'graph LR; A --> B' | moomaid -
# HTML output
moomaid --html diagram.mmd
# HTML demo page (all diagram types)
moomaid --html--svg Output SVG (default: ASCII)
--ascii Output ASCII art
--kitty Output Kitty graphics protocol
--html Output HTML with embedded SVG
--width <n> Max width for ASCII (default: 80)
For kitty: image width in px (default: 640)
- Read from stdin
--help Show help# Local Wasm package
moon runwasm src/cmd/skill --format ascii < diagram.mmd
moon runwasm src/cmd/skill --format svg < diagram.mmd
moon runwasm src/cmd/skill --format svg --debug-layout < diagram.mmd
# Standalone script prototype with the same contract
moon run --target wasm examples/moomaid.mbtx --format ascii < diagram.mmdgraph LR
Input --> Process --> Outputgraph TD
Start[Start] --> Auth{Auth}
Auth -->|pass| Load[Load Data]
Auth -->|fail| Error[Error Page]
Load --> Validate{Validate}
Validate -->|ok| Process[Process]
Validate -->|ng| Error
Process --> Save[Save]
Save --> Done[Done]
Error --> Doneflowchart TD
Client --> API
subgraph backend[Backend]
API --> DB
endsequenceDiagram
participant Browser
participant API
participant Auth
participant DB
Browser->>API: POST /login
API->>Auth: Validate token
Auth-->>API: OK
API->>DB: SELECT user
DB-->>API: User data
API-->>Browser: 200 JSON// ASCII output
let ascii = @moomaid.render_to_string("graph LR\n A --> B")
// ASCII with options
let options : @moomaid.Options = {
use_ascii: false,
padding_x: 2,
padding_y: 1,
box_border_padding: 1,
max_width: 80,
}
let ascii2 = @moomaid.render_to_string("graph LR\n A --> B", options~)
// SVG output (experimental)
let svg = @moomaid.experimental_render_to_svg("graph LR\n A --> B")
// Portable Skill API
let skill_svg = @moomaid.render(
"graph LR\n A --> B",
@moomaid.OutputFormat::Svg,
)just tuiMermaid diagram renderer for MoonBit (ASCII and SVG output)
Dependencies