Expand description
§anytomd
A pure Rust library that converts various document formats into Markdown, designed for LLM consumption.
§Supported Formats
| Format | Extensions |
|---|---|
| DOCX | .docx |
| PPTX | .pptx |
| XLSX | .xlsx |
| XLS | .xls |
| HTML | .html, .htm |
| CSV | .csv |
| Jupyter Notebook | .ipynb |
| JSON | .json |
| XML | .xml |
| Images | .png, .jpg, .gif, .webp, .bmp, .tiff, .svg, .heic, .avif |
| Code | .py, .rs, .js, .ts, .c, .cpp, .go, .java, and more |
| Plain Text | .txt, .md, .rst, .log, .toml, .yaml, .ini, etc. |
§Quick Start
use anytomd::{convert_bytes, ConversionOptions};
// Convert raw bytes with an explicit format
let options = ConversionOptions::default();
let csv_data = b"Name,Age\nAlice,30\nBob,25";
let result = convert_bytes(csv_data, "csv", &options).unwrap();
println!("{}", result.markdown);On native targets, file-based conversion is also available:
use anytomd::{convert_file, ConversionOptions};
let options = ConversionOptions::default();
let result = convert_file("document.docx", &options).unwrap();
println!("{}", result.markdown);§Feature Flags
| Feature | Description |
|---|---|
async | Async API: convert_file_async, convert_bytes_async, AsyncImageDescriber |
async-gemini | AsyncGeminiDescriber for concurrent Gemini API calls |
wasm | WebAssembly bindings via wasm-bindgen (convertBytes, convertBytesWithOptions) |
wasm + async-gemini | Adds convertBytesWithGemini for async Gemini-powered conversion in WASM |
Re-exports§
pub use converter::AsyncConversionOptions;pub use converter::AsyncImageDescriber;pub use converter::ConversionOptions;pub use converter::ConversionResult;pub use converter::ConversionWarning;pub use converter::Converter;pub use converter::ImageDescriber;pub use converter::WarningCode;pub use error::ConvertError;
Modules§
- converter
- Document format converters and shared conversion types.
- detection
- File format detection by magic bytes, file extension, and ZIP introspection.
- error
- Error types for document conversion.
- gemini
- Built-in Google Gemini image description providers.
- markdown
- Shared Markdown generation utilities.
Functions§
- convert_
bytes - Convert raw bytes to Markdown with an explicit format extension.
- convert_
bytes_ async - Convert raw bytes to Markdown with async image description.
- convert_
file - Convert a file at the given path to Markdown.
- convert_
file_ async - Convert a file at the given path to Markdown with async image description.