markdownify

Crates.iomarkdownify
lib.rsmarkdownify
version
sourcesrc
created_at2025-05-03 23:07:28.914682+00
updated_at2025-05-15 18:18:28.432685+00
descriptionmarkitdown in rust - convert various document and files into markdown
homepagehttps://github.com/Skardyy/mcat
repositoryhttps://github.com/Skardyy/mcat
max_upload_size
id1659214
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Meron Bossin (Skardyy)

documentation

https://github.com/Skardyy/mcat

README

markdownify

A Rust library for converting various document formats to Markdown, part of the mcat project.

Crates.io Documentation MIT License

Overview

markdownify is a Rust implementation inspired by Microsoft's markitdown Python project. It provides functionality to convert various document formats to Markdown, making them easier to view, share, and integrate into AI prompts.

Supported Formats

Format Extension Description
Word Documents .docx Microsoft Word documents
OpenDocument Text .odt, .odp OpenDocument text files
PDF .pdf Portable Document Format files
PowerPoint .pptx Microsoft PowerPoint presentations
Excel/Spreadsheets .xlsx, .xls, .xlsm, .xlsb, .xla, .xlam, .ods Various spreadsheet formats
CSV .csv Comma-separated values (auto-detects delimiter)
ZIP Archives .zip Extracts and converts contained files
Other text formats (various) Falls back to code block formatting

Installation

Add to your Cargo.toml:

[dependencies]
markdownify = "0.1.1"

Usage

Basic Usage

use std::path::Path;
use markdownify::convert;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Convert a file to markdown
    let path = Path::new("document.docx");
    let markdown = convert(&path, None)?;
    println!("{}", markdown);
    
    // With an optional name header
    let name = String::from("My Spreadsheet");
    let path = Path::new("spreadsheet.xlsx");
    let markdown = convert(&path, Some(&name))?;
    println!("{}", markdown);
    
    Ok(())
}

Working with Specific Formats

You can also use the format-specific converters directly:

use std::path::Path;
use markdownify::{docx, pdf};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Convert a Word document
    let path = Path::new("document.docx")
    let markdown = docx::docx_convert(&path)?;
    
    // Convert a PDF
    let path = Path::new("document.pdf")
    let markdown = pdf::pdf_convert(&path)?;
    
    // same for the others..
    
    Ok(())
}

License

This project is licensed under the MIT License - see the LICENSE under mcat for details.

Commit count: 0

cargo fmt