← all repositories
xberg-io/html-to-markdown

One Rust core, sixteen bindings, and a deep distrust of your HTML

It turns messy real-world HTML into clean Markdown or Djot without silently dropping content.

854 stars HTML Data ToolingOther AI
html-to-markdown
Not currently ranked — collecting fresh signals.
star history

What it does

html-to-markdown takes HTML and emits CommonMark-compliant Markdown or Djot. A single convert() entry point is exposed across sixteen language bindings, from Python and Node.js to Zig, Swift, and C. The project is built around the assumption that real-world HTML is broken: it handles unclosed tags, nested tables, and mixed encodings while preserving content.

The interesting bit

Instead of forcing every input through a heavy DOM parser, the converter runs a fast byte scanner on clean HTML and escalates to a DOM walker or html5ever only when it encounters custom elements, nested tables, or malformed entities. The README claims the output stays byte-identical across all three tiers, enforced by a 116-snapshot oracle and per-group performance regression gates in CI.

Key highlights

  • One Rust core feeds 16 language bindings, including Python, Node.js, Go, Java, C#, PHP, Ruby, Elixir, R, Dart, Kotlin, Swift, Zig, WASM, and a C FFI.
  • Three-tier dispatch: a single-pass byte scanner for clean HTML, a DOM walker for complex inputs, and html5ever for malformed HTML. The caller just sees convert().
  • Output is byte-identical across tiers, guarded by a 116-snapshot oracle and per-group performance regression gates in CI.
  • Supports CommonMark and GFM tables, plus Djot output, metadata extraction, inline images, and a visitor API for AST transforms.
  • Tier-1 handles 110+ tags natively; Tier-2 and Tier-3 provide full HTML5 coverage for adversarial or broken input.

Verdict

Worth a look if you need to convert messy HTML to Markdown from multiple languages without maintaining separate parsers. Probably overkill if your input is always pristine and you only work in one ecosystem.

Frequently asked

What is xberg-io/html-to-markdown?
It turns messy real-world HTML into clean Markdown or Djot without silently dropping content.
Is html-to-markdown open source?
Yes — xberg-io/html-to-markdown is open source, released under the MIT license.
What language is html-to-markdown written in?
xberg-io/html-to-markdown is primarily written in HTML.
How popular is html-to-markdown?
xberg-io/html-to-markdown has 854 stars on GitHub.
Where can I find html-to-markdown?
xberg-io/html-to-markdown is on GitHub at https://github.com/xberg-io/html-to-markdown.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.