Herb Rust Bindings
Rust bindings for Herb - An ecosystem of powerful and seamless developer tools for HTML+ERB templates.
Crates
This is a Cargo workspace. herb is the binding to the C library, the rest build on top of it.
| Crate | Binary | Description |
|---|---|---|
herb |
herb-rust |
Bindings to the Herb C library: lexing, parsing, and the AST |
herb-config |
Shared configuration utilities, reads .herb.yml |
|
herb-highlighter |
herb-highlight |
Syntax highlighter, snippet renderer and diagnostic renderer |
herb-printer |
herb-print |
Printers that reconstruct source from a Herb AST |
Each binary sits behind the crate's cli feature, so a library consumer does not pull in its dependencies:
Building
Prerequisites
- Rust toolchain
- Bundler with Prism gem installed in the parent directory
Build
Usage
CLI (within the Herb repo)
The other crates ship their own binaries:
As a Library
use ;
Testing
Publishing
Before publishing to crates.io, vendor the C sources:
The vendor/ directory is gitignored to avoid committing duplicate files. The make vendor task copies C sources from the parent directory into vendor/libherb and vendor/prism so the published crate is self-contained.
Only herb is published today. The other crates carry the metadata to be published with cargo publish -p <crate>, and depend on each other by version as well as by path so that packaging resolves. They have to go out in dependency order, herb and herb-config before herb-printer, since Cargo resolves the version side of a path dependency against crates.io.
Cleaning