ChordSketch
A Rust implementation of the ChordPro file format parser and renderer. 100% ChordPro compatible. Supports parsing ChordPro files into a structured AST and rendering to plain text, HTML, and PDF.
Features
- Full ChordPro format parser with zero external dependencies in the core crate
- Three output formats: plain text, HTML, and PDF
- Chord transposition
- Configuration file system (chordsketch.json)
- Inline markup (bold, italic, etc.)
- Chord diagrams and extended
{define}directives - Section environments (verse, chorus, tab, grid, custom)
- Delegate environments (ABC, Lilypond, SVG, textblock)
- Conditional directive selectors (instrument, user)
- Multi-song files (
{new_song}) - Font, size, and color directives
- Image directive
- Multi-page PDF with page control
Try it Online
ChordSketch Playground — try ChordPro rendering directly in your browser, no installation required.
Installation
npm (WASM)
npm install @chordsketch/wasmSee the @chordsketch/wasm README for usage with JavaScript/TypeScript.
Homebrew (macOS / Linux)
brew tap koedame/tap
brew install chordsketchScoop (Windows)
scoop bucket add koedame https://github.com/koedame/scoop-bucket
scoop install chordsketchwinget (Windows)
winget install koedame.chordsketchDocker
docker run --rm ghcr.io/koedame/chordsketch --version
docker run --rm -v "$PWD:/data" ghcr.io/koedame/chordsketch /data/song.choFrom crates.io
cargo install chordsketchFrom source
Requires Rust 1.85 or later.
git clone https://github.com/koedame/chordsketch.git
cd chordsketch
cargo install --path crates/cliUsage
# Render to plain text (default)
chordsketch song.cho
# Render to HTML
chordsketch -f html song.cho -o song.html
# Render to PDF
chordsketch -f pdf song.cho -o song.pdf
# Transpose up 2 semitones
chordsketch --transpose 2 song.cho
# Use a custom config file
chordsketch -c myconfig.json song.cho
# Process multiple files
chordsketch -f pdf song1.cho song2.cho -o songbook.pdfLibrary Usage
The core parser and renderers are available as separate library crates:
use chordsketch_core::parser::parse;
use chordsketch_render_text::render_song;
let input = "{title: Amazing Grace}\n{subtitle: Traditional}\n\n[G]Amazing [G7]grace, how [C]sweet the [G]sound";
let song = parse(input).unwrap();
let text = render_song(&song);
println!("{text}");Workspace Structure
| Crate | Description |
|---|---|
chordsketch-core |
Parser, AST, and transforms (zero external dependencies) |
chordsketch-render-text |
Plain text renderer |
chordsketch-render-html |
HTML renderer |
chordsketch-render-pdf |
PDF renderer |
chordsketch |
Command-line tool |
chordsketch-wasm |
WebAssembly bindings via wasm-bindgen |
Packages
| Package | Path | Description |
|---|---|---|
@chordsketch/wasm |
packages/npm |
npm package with TypeScript types |
| Playground | packages/playground |
Browser-based ChordPro editor and renderer |
Links
- ChordPro file format specification
- Configuration guide
- Versioning and release process
- SECURITY.md
- CHANGELOG.md
License
SDK crates (core, renderers, CLI): MIT
Future application layer (Forum, Playground, Desktop): AGPL-3.0-only