html-to-markdown¶
Convert HTML to Markdown, Djot, or plain text. One Rust core plus 15 generated packages, identical output on every runtime. Part of the xberg.io document intelligence ecosystem.
Why html-to-markdown¶
- Rust core
Single-pass DOM walk written in Rust. The same code path runs from Python, the browser, and the CLI — no per-language conversion logic.
- 16 language surfaces
Rust plus generated packages for Python, TypeScript, Go, Ruby, PHP, Java, C#, Elixir, R, C, WebAssembly, Swift, Dart, Kotlin Android, and Zig.
- Three output formats Available by v3.6
Markdown (CommonMark) by default, plus Djot and plain text via output_format. The same options apply to every format.
- Metadata extraction Available by v3.6
Document title, Open Graph, Twitter Card, JSON-LD, links, and images in one pass. Enabled by default — disable with extract_metadata: false.
- Table extraction Available by v3.6
HTML tables into result.tables with structured cells, row/column spans, and header flags, alongside the rendered Markdown.
- Visitor pattern Available by v3.6
40 callbacks on the HtmlVisitor trait to skip, replace, or preserve nodes. Kotlin Android excludes visitor support. Zero cost when unused.
Language Support¶
| Language | Install | API Reference |
|---|---|---|
| Rust | cargo add html-to-markdown-rs |
Reference |
| Python | pip install html-to-markdown |
Reference |
| TypeScript / Node | npm install @xberg-io/html-to-markdown |
Reference |
| Go | go get github.com/xberg-io/html-to-markdown/packages/go/v3 |
Reference |
| Ruby | gem install html-to-markdown |
Reference |
| PHP | pie install xberg-io/html-to-markdown |
Reference |
| Java | Maven io.xberg:html-to-markdown |
Reference |
| C# | dotnet add package XbergIo.HtmlToMarkdown |
Reference |
| Elixir | {:html_to_markdown, "~> 3.4"} |
Reference |
| R | install.packages("htmltomarkdown") |
Reference |
| C (FFI) | Shared library + header | Reference |
| WebAssembly | npm install @xberg-io/html-to-markdown-wasm |
Reference |
| Swift | Swift Package HtmlToMarkdown |
Reference |
| Dart | dart pub add h2m |
Reference |
| Kotlin Android | Maven io.xberg:html-to-markdown-android |
Reference |
| Zig | Zig package html_to_markdown_rs |
Reference |
| CLI | cargo install html-to-markdown-cli |
CLI Guide |
Quick Example¶
Part of Xberg.dev¶
html-to-markdown ships as a standalone library and as the HTML pipeline inside the Xberg document intelligence stack.
Document intelligence core — text, tables, and metadata from 91+ file formats. Uses html-to-markdown for every HTML input.
Managed SaaS API for document extraction. Same engine, no infrastructure.
Web crawler that pairs with html-to-markdown for crawl-then-convert pipelines.
Universal LLM client — feed it the Markdown out of html-to-markdown.
306 Tree-sitter grammars on demand for code intelligence.
Community chat for xberg.io users and contributors.
Explore the Docs¶
- Get Started
Install a binding and run your first convert() call.
- Guides
Visitor pattern, table extraction, error handling.
- Concepts
Architecture, conversion pipeline, plugin system.
- Reference
Options reference, generated API docs, per-language guides.
- CLI
Every conversion option as a command-line flag.
- Migration
Upgrading from earlier versions.
Getting Help¶
- Bugs and feature requests — Open an issue on GitHub
- Community chat — Join the Discord
- Contributing — Read the contributor guide