Skip to main content

Crate anytomd

Crate anytomd 

Source
Expand description

§anytomd

A pure Rust library that converts various document formats into Markdown, designed for LLM consumption.

§Supported Formats

FormatExtensions
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

FeatureDescription
asyncAsync API: convert_file_async, convert_bytes_async, AsyncImageDescriber
async-geminiAsyncGeminiDescriber for concurrent Gemini API calls
wasmWebAssembly bindings via wasm-bindgen (convertBytes, convertBytesWithOptions)

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.