| Crates.io | markitdown |
| lib.rs | markitdown |
| version | 0.1.10 |
| created_at | 2025-01-22 07:32:59.75581+00 |
| updated_at | 2025-05-20 09:23:10.417529+00 |
| description | A Rust library designed to facilitate the conversion of various document formats into markdown text. |
| homepage | |
| repository | https://github.com/uhobnil/markitdown-rs |
| max_upload_size | |
| id | 1526413 |
| size | 2,496,730 |
markitdown-rs is a Rust library designed to facilitate the conversion of various document formats into markdown text. It is a Rust implementation of the original markitdown Python library.
It supports:
cargo install markitdown
markitdown path-to-file.pdf
Or use -o to specify the output file:
markitdown path-to-file.pdf -o document.md
Add the following to your Cargo.toml:
[dependencies]
markitdown = "0.1.10"
use markitdown::MarkItDown;
let mut md = MarkItDown::new();
use markitdown::{ConversionOptions, DocumentConverterResult};
let options = ConversionOptions {
file_extension: Some(".xlsx".to_string()),
url: None,
llm_client: None,
llm_model: None,
};
let result: Option<DocumentConverterResult> = md.convert("path/to/file.xlsx", Some(options));
// To use Large Language Models for image descriptions, provide llm_client and llm_model, like:
let options = ConversionOptions {
file_extension: Some(".jpg".to_string()),
url: None,
llm_client: Some("gemini".to_string()),
llm_model: Some("gemini-2.0-flash".to_string()),
};
let result: Option<DocumentConverterResult> = md.convert("path/to/file.jpg", Some(options));
if let Some(conversion_result) = result {
println!("Converted Text: {}", conversion_result.text_content);
} else {
println!("Conversion failed or unsupported file type.");
}
You can extend MarkItDown by implementing the DocumentConverter trait for your custom converters and registering them:
use markitdown::{DocumentConverter, MarkItDown};
struct MyCustomConverter;
impl DocumentConverter for MyCustomConverter {
// Implement the required methods here
}
let mut md = MarkItDown::new();
md.register_converter(Box::new(MyCustomConverter));
MarkItDown is licensed under the MIT License. See LICENSE for more details.