mdka
A HTML to Markdown converter written in Rust.

mdka balances conversion quality with runtime efficiency —
readable output from real-world HTML, without sacrificing speed or memory.
"ka" means "化 (か)" pointing to conversion.
Why mdka?
There are several good HTML-to-Markdown converters in the Rust ecosystem. mdka's specific focus is:
- Reliable output from diverse HTML sources. It is built on scraper, which uses html5ever — the HTML5 parser from the Servo browser engine. html5ever applies the same parsing algorithm that web browsers use, so it handles malformed tags, deeply nested structures, CMS output, and SPA-rendered DOM without special-casing.
- Crash resistance. Conversion uses non-recursive DFS throughout. There is no stack overflow, no matter the nesting depth.
- Configurable pre-processing. Five conversion modes let you tune what gets kept or stripped, from noise-free LLM input to maximum retention. Three of the five currently produce identical output — see Conversion Modes.
- Multi-language. The same Rust implementation is accessible from Node.js (napi-rs) and Python (PyO3).
Quick Start
Try it from the command line
Download a prebuilt binary (no Rust toolchain needed) from the latest release:
| Platform | Asset |
|---|---|
| Linux x64 (glibc) | mdka@Linux-x64-gnu-<version>.tar.gz |
| Linux x64 (musl) | mdka@Linux-x64-musl-<version>.tar.gz |
| Linux aarch64 (musl) | mdka@Linux-aarch64-musl-<version>.tar.gz |
| macOS Apple Silicon | mdka@macOS-aarch64-<version>.zip |
| Windows x64 | mdka@Windows-x64-<version>.zip |
Other platforms (macOS Intel, Windows ARM, Linux aarch64 glibc) aren't built
as binaries — use cargo install mdka-cli below instead.
Extract the archive; it contains one folder holding the mdka binary:
|
# # Hello
#
# **world**
Or install via cargo — requires cargo (Rust language) installed:
|
# # Hello
#
# **world**
Add to a Rust project
# Cargo.toml
[]
= "2"
use html_to_markdown;
let md = html_to_markdown;
// "# Hello\n\n*world*\n"
With options:
use html_to_markdown_with;
use ;
let html = "<nav>menu</nav><h1>Hello</h1>";
let mut opts = for_mode;
opts.drop_interactive_shell = true;
let md = html_to_markdown_with;
// "# Hello\n"
Add to a Node.js project
const = require
const md =
// "# Hello\n"
Add to a Python project
=
# "# Hello\n"
=
=
Conversion Modes
| Mode | Use when |
|---|---|
Balanced |
General use — default |
Strict |
Debugging, diff comparison |
Minimal |
LLM input, text extraction |
Semantic |
SPA content, ARIA-aware pipelines |
Preserve |
Archiving, audit trails |
Balanced, Strict and Preserve currently produce identical output. They
differ only in the defaults of five fields that have no effect, so choosing
between them changes nothing today. They remain distinct API and may diverge
again — see
Conversion Modes, which explains
why in full.
Tables are not yet converted. <table> cell text is emitted without
structure or separators, so a table becomes a run of joined text. See
Supported Elements for the
full list of what is and is not supported.
Learn More
Full documentation is published as GitHub Pages, and its source lives in
docs/.
https://nabbisen.github.io/mdka-rs/
| Topic | Link |
|---|---|
| Installation | /getting-started/installation |
| Rust Usage & Examples | /getting-started/usage-rust |
| Node.js Usage | /getting-started/usage-nodejs |
| Python Usage | /getting-started/usage-python |
| CLI Reference | /getting-started/usage-cli |
| API Reference | /api/index |
| Conversion Modes | /api/modes |
| ConversionOptions | /api/options |
| Supported Elements | /api/elements |
| Design Philosophy | /design/philosophy |
| Performance Characteristics | /design/performance-characteristics |
| Architecture | /design/architecture |
| Features | /design/features |
| Changelog | CHANGELOG.md |
| Roadmap | ROADMAP.md |
Open-source, with care
This project is lovingly built and maintained by volunteers.
We hope it helps streamline your work.
Please understand that the project has its own direction — while we welcome feedback, it might not fit every edge case 🌱
Acknowledgements
Depends on scraper (+ html5ever), ego-tree, rayon, thiserror.
Also, napi-rs on binding for Node.js and PyO3's pyo3 / maturin on bindings for Python.