Skip to content

feat: add legacy .doc conversion support - #2307

Open
mikemikimike wants to merge 4 commits into
microsoft:mainfrom
mikemikimike:feat/doc-extension-support
Open

feat: add legacy .doc conversion support#2307
mikemikimike wants to merge 4 commits into
microsoft:mainfrom
mikemikimike:feat/doc-extension-support

Conversation

@mikemikimike

Copy link
Copy Markdown

Related issue

Fixes #23

Summary

Adds optional conversion support for legacy binary .doc files using the unword parser.

Implementation

  • Added DocConverter, which recognizes .doc files and returns the parser's body text as Markdown.
  • Added the doc optional dependency and included it in the all feature.
  • Registered the converter independently from the existing .docx converter.
  • Added tests for extension detection, successful conversion, and missing dependency handling.

Compatibility

Existing .docx and other converters are unchanged. .doc support is opt-in through markitdown[doc] or included in markitdown[all]. Rich layout extraction is limited to the text exposed by unword.

Validation

  • python -m pytest tests/test_doc_converter.py -q — 3 passed.
  • python -m mypy --ignore-missing-imports src/markitdown/converters/_doc_converter.py tests/test_doc_converter.py — passed.
  • python -m black --check src/markitdown/converters/_doc_converter.py tests/test_doc_converter.py — passed.
  • python -m pre_commit run --all-files — passed.
  • python -m pytest -q --basetemp=.pytest-tmp — not fully green in this Windows environment: existing CLI vector tests encounter GBK decoding errors, and test_file_uris expects Unix-style paths. The focused and unaffected tests passed before those environment-specific failures.

Limitations

No binary .doc fixture is included; extensionless MIME sniffing and rich layout reconstruction are out of scope.

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.

Support for .doc extensions

1 participant