Skip to content

Installation

Install html-to-markdown for your language using the commands below. Each binding wraps the same Rust core, so behavior matches across runtimes. Pick a tab under Language bindings for copy-paste snippets, feature flags, and a quick verification step where applicable.

Language Min version Package
Rust 1.85 html-to-markdown-rs on crates.io
Python 3.10 html-to-markdown on PyPI
TypeScript / Node.js Node.js 18 @xberg-io/html-to-markdown on npm
Go 1.26 github.com/xberg-io/html-to-markdown/packages/go/v3
Ruby 3.2 html-to-markdown on RubyGems
PHP 8.2 xberg-io/html-to-markdown on Packagist
Java 25 io.xberg:html-to-markdown on Maven Central
C# .NET 10 XbergIo.HtmlToMarkdown on NuGet
Elixir 1.14 html_to_markdown on Hex
R 4.2 htmltomarkdown on CRAN
C libhtml_to_markdown (GitHub Releases)
WebAssembly @xberg-io/html-to-markdown-wasm on npm
Swift Swift 6.0 HtmlToMarkdown SwiftPM package
Dart 3.11 h2m on pub.dev
Kotlin Android Android minSdk 21 io.xberg:html-to-markdown-android on Maven Central
Zig 0.16 html_to_markdown_rs Zig package

Add to Cargo.toml:

[dependencies]
html-to-markdown-rs = "3.6"

Or via cargo add:

Terminal window
cargo add html-to-markdown-rs

Verify:

use html_to_markdown_rs::convert;
fn main() {
let result = convert("<h1>Hello</h1>", None).unwrap();
println!("{}", result.content.unwrap());
// # Hello
}

By default only the metadata feature is enabled. Opt in to additional features as needed:

Feature Enables Default Availability
metadata HtmlMetadata extraction and all extract_* options yes Available by v3.6
visitor HtmlVisitor trait and ConversionError::Visitor no Available by v3.6
inline-images data-URI decoding and inline SVG extraction no Available by v3.6
serde Serialize/Deserialize on all public option and result types no Available by v3.6
full all of the above no Available by v3.6
# With visitor support
html-to-markdown-rs = { version = "3.6", features = ["visitor"] }
# Everything
html-to-markdown-rs = { version = "3.6", features = ["full"] }

If pip install html-to-markdown fails on Windows 11 with Python 3.14 or later, try these steps:

  1. Force the prebuilt wheel:

    Terminal window
    pip install --only-binary=:all: html-to-markdown

    This prevents fallback to source build. If this fails, a wheel resolution issue exists — try updating pip or uv.

  2. Enable MSVC compiler (if sdist build is required): Install Microsoft Visual Studio Build Tools with the “Desktop development with C++” workload. Then ensure MSVC’s link.exe precedes any GNU variants in PATH. Check with where link — the first result should be a path under VC\Tools\MSVC.

  3. Update pip or uv: Python 3.14 wheel tags are recent. Run pip install --upgrade pip or uv self update to ensure correct wheel matching.


Install via Cargo:

Terminal window
cargo install html-to-markdown-cli

Or via Homebrew:

Homebrew 6.0+ requires explicit trust for third-party taps. Trust once, then install:

Terminal window
brew trust xberg-io/tap
brew install xberg-io/tap/html-to-markdown

Verify:

Terminal window
echo "<h1>Hello</h1>" | html-to-markdown
# # Hello

See CLI reference for all flags and options.


Found a bug or mistake on this page?

If something here is wrong or out of date, open an issue on GitHub or contribute a fix via pull request.