Skip to content

Quick Start

Install the crate and render Markdown to HTML in one call.

cargo add ferromark
let html = ferromark::to_html("# Hello\n\n**World**");

Start from the dialect constructor that matches your content — Options::minimal(), Options::commonmark(), or Options::gfm() — and override individual flags:

use ferromark::Options;

let options = Options {
    front_matter: true,
    ..Options::gfm()
};
let html = ferromark::to_html_with_options(markdown, &options);

Reuse output buffers

When allocation pressure matters, reuse a Vec<u8>:

let mut buffer = Vec::new();
ferromark::to_html_into("# Reuse me", &mut buffer);

Enable MDX support

MDX support is opt-in via feature flag:

cargo add ferromark --features mdx

See MDX Examples for full code paths.

Use the Node.js package

Install the native ESM package on Node.js 22 or newer:

npm install ferromark
import { toHtml } from 'ferromark'

const html = toHtml('# Hello', { tables: true })

Highlight fenced code with Ferriki

An initialized Ferriki highlighter plugs into the Node API without coupling the two Rust cores:

import { createHighlighter } from 'ferriki'
import { toHtmlWithHighlighter } from 'ferromark'

const highlighter = await createHighlighter({
  langs: ['rust'],
  themes: ['github-dark'],
})

const html = toHtmlWithHighlighter(
  '```rust\nfn main() {}\n```',
  highlighter,
  { theme: 'github-dark' },
)

Highlighter errors fall back to escaped code-block output.