Skip to content

feat: Add DOC file support - #1316

Open
Shehab (ashmod) wants to merge 4 commits into
microsoft:mainfrom
ashmod:main
Open

Shehab (ashmod) wants to merge 4 commits into
microsoft:mainfrom
ashmod:main

Conversation

@ashmod

@ashmod Shehab (ashmod) commented Jul 8, 2025 •

Copy link
Copy Markdown

Summary

Adds support for legacy Microsoft Word DOC files (.doc) to MarkItDown.

Implementation Details

I could not find an out-of-the-box library to do doc to md conversion, so I went with a 2-step approach, converting the doc to docx then converting the docx using the converter module to md. The minor issue here is the dependencies, all libraries require some sort of dependency (usually Libreoffice), I implemented an OS-specific approach that checks if the user is on Linux, it uses the Libreoffice cli tool, but, on Windows it would use MS Word's COM interface, this is to eliminate the need to install external dependencies as much as possible.

Testing

  • All existing tests pass
  • DocConverter properly registered and accepts DOC files, correctly parses content.
    (Testing passed on Linux & Windows)

Fixes #23
Fixes #1220

- Add DocConverter for legacy Microsoft Word DOC files
- Uses pure Python approach with olefile (existing dependency)
- Handles .doc files and application/msword mimetype
- Adds doc optional dependency group in pyproject.toml
- Updates converter registration in main MarkItDown class
- Adds test vector for DOC file conversion
- No external system dependencies required
@BetterAndBetterII

Copy link
Copy Markdown
Contributor

really need it

Shehab (ashmod) and others added 2 commits July 15, 2025 00:13
This commit replaces the old implementation with a robust, two-step conversion process that significantly improves reliability and accuracy:

1.  The `_doc_converter` now first converts the input `.doc` file to a `.docx` file using OS-dependent tools:
    - **Windows**: Microsoft Word's COM interface via `pywin32`.
    - **Linux/macOS**: LibreOffice/Soffice command-line interface.

2.  The `_docx_converter` is then used to convert the `.docx` file into markdown
@keller31

Copy link
Copy Markdown

I really need this doc conversion!!!

@ashmod Shehab (ashmod) changed the title Added DOC file support to MarkItDown feat: Add DOC file support Aug 19, 2025
@HOUTASU

Copy link
Copy Markdown

+1 we need it

@SystemAgent

Copy link
Copy Markdown

+1 on needing this doc change, it will resolve a lot of problems 🙏

@JonLev

Copy link
Copy Markdown

+1 the PR is open from a long time. Can't we merge it ?

@vkavalerov

Copy link
Copy Markdown

+1 really needed

@Xirider

Copy link
Copy Markdown

+1 would be great if this could get merged.

@jsun-m

jsun-m commented Nov 6, 2025

Copy link
Copy Markdown

+1 Please, we yearn for this

@bencegadanyi1-nhs

Copy link
Copy Markdown

+1 please, would make it one step easier for us to use this package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unsupported DOC file content type (application/msword) Support for .doc extensions

10 participants