| Crates.io | pisnge |
| lib.rs | pisnge |
| version | 0.2.5 |
| created_at | 2025-07-01 04:32:53.12443+00 |
| updated_at | 2025-08-03 07:24:36.574509+00 |
| description | A Rust-based diagram rendering library inspired by Mermaid.js, focused on generating SVG pie charts |
| homepage | |
| repository | https://github.com/insidewhy/pisnge |
| max_upload_size | |
| id | 1732751 |
| size | 975,458 |
A Rust-based diagram rendering library compatible with mermaidjs.
Download the latest binary from Releases:
# Download the binary
wget https://github.com/insidewhy/pisnge/releases/latest/download/pisnge-ubuntu-22.04
# Make it executable
chmod +x pisnge-ubuntu-22.04
# Use it directly
./pisnge-ubuntu-22.04 --help
cargo install pisnge
git clone https://github.com/insidewhy/pisnge
cd pisnge
cargo build --release
# Basic usage
pisnge -i input.mmd -o output.svg
# Specify format (defaults to png)
pisnge -i chart.mmd -o chart.svg -f svg
pisnge -i chart.mmd -o chart.png -f png
# Custom font and dimensions
pisnge -i chart.mmd -o chart.svg --font "Arial" --width 1000 --height 800
# Verbose output
pisnge -i chart.mmd -o chart.svg --verbose
# If running from source
cargo run -- -i input.mmd -o output.svg
-i, --input: Input Mermaid file (.mmd)-o, --output: Output file path-f, --format: Output format - "png" or "svg" (defaults to "png")-w, --width: Desired maximum width-H, --height: Desired maximum height--font: Font family name (defaults to "Liberation Sans")-v, --verbose: Show detailed parsing informationCharts will be rendered up to the maximum of width/height and the unfilled dimension will be reduced in the output rather than introducing borders into the image.
pie title My Pie Chart
"Label 1": 42
"Label 2": 30
"Label 3": 28
pie showData title Story Points by Status
"Done": 262
"To Do": 129
"In Progress": 87
%%{init: {'theme': 'base', 'themeVariables': {'pie1': '#ff6b6b', 'pie2': '#4ecdc4'}}}%%
pie showData title Custom Colors
"Category A": 60
"Category B": 40
# Render an example pie chart
pisnge -i examples/storypoints-by-status-pie.mmd -o output.svg
# Or if running from source
cargo run -- -i examples/storypoints-by-status-pie.mmd -o output.svg
xychart-beta
title "Issues in review or ready for QA"
x-axis [PJ-213, PJ-341, PJ-481, PJ-482, PJ-420]
y-axis "Number of days in status" 0 --> 10
bar [2, 0, 6, 8, 9]
bar [8.5, 7, 5, 3, 1]
%%{init: {
'width': 1000,
'theme': 'base',
'themeVariables': {
"xyChart":{
"plotColorPalette":"#aaaaaa,#cccccc,#4c82db,#9c1de9,#038411",
"plotPoints":"none,none,diamond,square,square",
"strokeStyles":"dashed,dashed,solid,solid,solid",
}
}
}}%%
xychart-beta
title "Burn-up chart"
legend [Original Target, Target, Commitment, Ready for QA, Done]
x-axis [Day 1, Day 2, Day 3, Day 4, Day 5, Day 6, Day 7, Day 8, Day 9, Day 10]
y-axis "Story points" 0 --> 120
line [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
line [12, 24, 36, 48, 60, 72, 84, 96, 108, 120]
line [100, 100, 110, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120]
line [5, 30, 36, 60]
line [0, 5, 15, 40]
The work-item-movement chart shows how work items (e.g. jira tickets) change story points and statuse over time:
work-item-movement
title 'Work Item Changes'
columns [Not Existing, Draft, To Do, In Progress, In Review, In Test, Done]
PJ-633 Not Existing: 0 -> Draft: 1
PJ-491 In Review: 3 -> Done: 3
PJ-1 In Progress: 5 -> Draft: 8
This project currently supports two types charts from mermaid and one new chart, for all charts only the base theme is supported with different default colors.
The pie chart segments are rendered in the order they are specified rather than from biggest to smallest, and the overall spacing is better since font widths/heights are measured directly.
For each set of bars in the same axis the tallest bars are drawn first to ensure that bars don't get entirely covered.
Bars are always drawn before lines.
Bars can have a height of 0, unlike mermaid, which will cause them not to be visible (mermaid will draw a short bar in this circumstance).
When pisnge detects that x-axis labels overlap each other it will automatically switch their orientation to be vertical.
Only a limited number of theme variables are currently supported:
titleFontSizelabelFontSizeplotColorPaletteNew options are supported which can be seen in the example above.
cargo test
cargo build
clap: Command-line argument parsingnom: Parser combinator used to parse mmd syntaxsvg: SVG generationresvg: SVG to PNG conversiontiny-skia: 2D graphics rasterizationfont-kit: For loading system fontsrusttype: For measuring text widths/heightsMIT License - see LICENSE file for details.
Contributions welcome! This library currently focuses on pie charts but could be extended to support other Mermaid diagram types.