Markkit
Extract clean markdown from any format.
Markkit is a Rust library and CLI tool for converting HTML, PDF, DOCX, spreadsheets, and other document formats into well-structured markdown. It provides native bindings for Python and Node.js.
Features
- HTML – Convert web pages and HTML documents to markdown
- DOCX – Convert Word documents (headings, lists, tables, links, emphasis)
- Spreadsheets – Convert XLSX/XLSM, XLS and ODS workbooks to markdown tables
- PDF – Planned (currently reported as unsupported)
- URL fetching – Fetch and extract from URLs directly
- Configurable – CSS selectors for include/exclude, resource limits
- Safe – Input sanitization, resource limits, no code execution
Quick Start
Rust Library
use Markkit;
let markkit = builder.build;
let md = markkit.extract_html.await?;
Documents from bytes
use ;
let markkit = builder.build;
// Detection order: content type, then file extension, then magic bytes.
let hint = DocumentHint ;
// CPU-bound: call the sync variant from `tokio::task::spawn_blocking` in async code.
let doc = markkit.extract_document_sync?;
println!;
println!;
Extraction carries markdown, title, format, warnings (e.g. truncated_sheet: …)
and stats (sheets/rows/paragraphs/tables). extract_bytes remains as a Markdown-only
shortcut.
CLI
# From a URL
# From a file
# With CSS selector filtering
# JSON output with metadata
Python
= await
= await
Node.js
const = require;
const markdown = await ;
const markdown = await ;
Installation
Rust
[]
= "0.1"
CLI
Python
Node.js
Configuration
let markkit = builder
.max_input_size // 10MB limit
.max_processing_secs
.preserve_links
.preserve_images
.include_selector
.exclude_selector
.exclude_selector
.build;
Feature Flags
| Feature | Default | Description |
|---|---|---|
html |
Yes | HTML parsing and conversion |
http_client |
Yes | URL fetching via reqwest (extract_url) |
docx |
No | DOCX conversion (zip + quick-xml) |
spreadsheet |
No | XLSX/XLSM, XLS, ODS conversion (calamine) |
pdf |
No | Placeholder; PDF currently returns UnsupportedFormat |
all_formats |
No | html, pdf, docx, spreadsheet |
logging |
No | Structured tracing output |
http_client is optional. Embedders that fetch content themselves can build without
reqwest (no HTTP/TLS stack in the dependency tree):
[]
= { = "0.1", = false, = ["docx", "spreadsheet"] }
# add "html" if you also convert HTML
Office-document limits are configurable on the builder: max_archive_entries,
max_archive_entry_size, max_archive_total_size, max_spreadsheet_cells,
max_sheet_rows, max_sheet_cols, include_hidden_sheets.
Development
License
MIT License. See LICENSE for details.