Skip to content
dridkPublic

About

old MS-DOC binary format (*.doc) to markdown

Resources

Stars

12 stars

Watchers

0 watching

Forks

Latest commit

 

History

16 Commits

Folders and files

Repository files navigation

unword

Convert legacy Microsoft Word .doc files (OLE/CFB format) to Markdown. Inspired by antiword.

Extracts body text with heading levels, page breaks, and textbox contents. No external dependencies (no LibreOffice, no COM).

Installation

CLI (Rust)

cargo install unword

Python

pip install unword

From source

Requires maturin and a virtual environment:

uv venv .venv && source .venv/bin/activate
maturin develop

Or build a wheel:

maturin build --release
pip install target/wheels/unword-*.whl

Usage

CLI

# Print to stdout
unword -i document.doc

# Write to file
unword -i document.doc -o output.md

Python

import unword

doc = unword.parse_doc(open("document.doc", "rb").read())

print(doc.body_text)      # Markdown string with headings
print(doc.textboxes)      # List of textbox strings

Rust library

let data = std::fs::read("document.doc")?;
let doc = unword::parse_doc(&data)?;
println!("{}", doc.body_text);

Output format

  • Headings are rendered as #, ##, ###, etc. based on Word styles
  • Paragraphs are separated by blank lines
  • Page breaks become ---
  • Textboxes are extracted separately

Tests

# Rust
cargo test

# Python
pytest tests/test_python.py

License

MIT

Alternative

  • antiword
  • abiword
  • tika
  • libreoffice

About

old MS-DOC binary format (*.doc) to markdown

Resources

Stars

12 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages