Ferromark / Rust
Start with Rust
Ferromark is an arena-allocated Markdown parser and HTML renderer. The Rust crate provides direct HTML helpers and an AST API for applications that need document structure. Requires Rust 1.95 or newer.
Install
cargo add ferromark
The current release is v3.7.0. V3 has breaking API changes from v2. Read the v2-to-v3 migration guide. For a v1 upgrade, follow the v1-to-v2 migration guide first, then the v2-to-v3 guide.
Save this in src/main.rs and run cargo run:
fn main() -> Result<(), ferromark::ParseError> {
let html = ferromark::to_html("Hello, **world**!")?;
assert_eq!(html, "<p>Hello, <strong>world</strong>!</p>\n");
println!("{html}");
Ok(())
}
Rust defaults preserve raw HTML. For untrusted Markdown, explicitly set
HtmlRendererOptions { sanitize: true, ..Default::default() } with
to_html_with_options as shown in configuration.
Choose your API
Scroll sideways for more columns.
| Your task | API |
|---|---|
| Render one document | to_html() → Result<String, ParseError> |
| Select syntax and rendering policy | to_html_with_options() |
| Append to an existing string | to_html_into() / to_html_into_with_options() |
| Inspect front matter or transform nodes | Allocator + Parser + HtmlRenderer |
| Customize HTML output | HtmlRenderHooks |
The source on main also exposes reference collection, text and section
extraction, and static Markdown projection on Document. See
document analysis for Rust examples and how to try
APIs that are not yet in your installed release.
Continue with configuration and content pipelines. The API reference lists all types and methods.