Add DocConverter for legacy .doc (Word 97-2003) files#1616
Open
vibeyclaw wants to merge 1 commit intomicrosoft:mainfrom
Open
Add DocConverter for legacy .doc (Word 97-2003) files#1616vibeyclaw wants to merge 1 commit intomicrosoft:mainfrom
vibeyclaw wants to merge 1 commit intomicrosoft:mainfrom
Conversation
Closes microsoft#23 Adds support for converting legacy .doc files to Markdown text using system tools (antiword or catdoc). The converter: - Accepts .doc extension and application/msword MIME type - Uses antiword or catdoc (whichever is available on the system) - Raises MissingDependencyException with clear install instructions if neither tool is found - Writes to a temp file for tool compatibility, cleans up after Install dependencies: macOS: brew install antiword Ubuntu/Debian: apt install antiword
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for converting legacy (Word 97-2003 binary format) files to Markdown, addressing #23.
Approach
The new
DocConverteruses system-level tools (antiwordorcatdoc) to extract text from legacy.docfiles, consistent with how other converters in the project handle format-specific dependencies.Why system tools?
The legacy
.docformat (OLE2/CFB binary) is complex to parse purely in Python.antiwordandcatdocare well-established, widely available tools that handle this reliably.Changes
converters/_doc_converter.py— newDocConverterclassconverters/__init__.py— exportDocConverter_markitdown.py— import and registerDocConverterUsage
Install a system tool first:
Then use normally:
If neither tool is installed, a
MissingDependencyExceptionis raised with clear installation instructions.Notes
antiwordis preferred (tried first);catdocis the fallback