Sign in

    moomaid

    Mermaid diagram renderer for MoonBit (ASCII and SVG output)

    mermaid
    diagram
    ascii
    svg
    flowchart
    sequence
    Download zip
    Author
    Version
    0.2.0
    License
    Apache-2.0
    Last updated
    2 months ago
    Downloads
    9K

    #moomaid

    Mermaid diagram renderer written in MoonBit. Outputs ASCII art or SVG.

    #Install

    # 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

    #CLI

    # 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

    #Options

    --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

    #Portable Skill API

    cmd/skill is the Wasm-friendly command package for skills.mooncakes.io. It accepts Mermaid source from standard input and writes exactly one rendered artifact on success.

    # Local Wasm package moon runwasm src/cmd/skill --format ascii < diagram.mmd moon runwasm src/cmd/skill --format svg < diagram.mmd # Standalone script prototype with the same contract moon run examples/moomaid.mbtx --format ascii < diagram.mmd

    The only supported flag is --format ascii|svg; the default is ascii. After publishing, the same command is runnable by its Mooncakes coordinate: moon runwasm mizchi/moomaid/cmd/skill@<version> --format svg.

    #Diagram Types

    #Flowchart (graph LR / graph TD)

    Use for visualizing data flow, module dependencies, and process graphs.

    graph LR Input --> Process --> Output

    graph 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 --> Done

    #Sequence Diagram (sequenceDiagram)

    Use for describing layer boundaries and API call flows.

    sequenceDiagram 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

    #Other supported types

    • stateDiagram-v2 - State machine diagrams
    • classDiagram - Class diagrams

    #Library Usage

    // 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,
    )

    #TUI Viewer

    Interactive terminal viewer with tab switching and Kitty graphics protocol support.

    just tui

    • Tab / Shift+Tab: Switch diagrams
    • Up / Down: Scroll
    • s: Toggle ASCII / SVG mode (Kitty-compatible terminals)
    • q: Quit

    #License

    Apache-2.0

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io