fix(epub): forward conversion options to the HTML converter - #2426
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix matches sibling converters and has appropriate regression coverage.
Pull request overview
Forwards conversion options from EPUB processing to the underlying HTML converter.
Changes:
- Passes
**kwargswhen converting EPUB chapters. - Adds regression coverage for data-URI handling and unchanged metadata/text.
File summaries
| File | Description |
|---|---|
packages/markitdown/src/markitdown/converters/_epub_converter.py |
Forwards conversion options. |
packages/markitdown/tests/test_module_misc.py |
Adds in-memory EPUB regression tests. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
What this changes
Conversion options are ignored for EPUB.
keep_data_uris=Truekeeps the image source forHTML, DOCX, XLSX and PPTX, but not for the same image inside an EPUB chapter:
Why
EpubConverter.convertaccepts**kwargsand then calls the HTML converter without them:Every other converter that renders through
HtmlConverterpasses the bag along:keep_data_urisis the option with a visible effect today -- it is a CLI flag(
--keep-data-uris) and reaches the converter throughconvert_stream/convert-- but thegap covers everything the caller passes, including the markdownify options
(
heading_style,bullets, ...) andstrict.Fix
Forward
**kwargs, exactly as the sibling converters do. One line.Tests
Added to
packages/markitdown/tests/test_module_misc.py, over a minimal in-memory EPUB whoseone chapter carries a data-URI image:
keep_data_uris=Truekeeps the full data URIdata:image/png;base64..., andthe payload does not appear
Against unmodified
main:With the fix:
How I tested
Windows 11, Python 3.12, editable install of
packages/markitdown[all].Those 18 are unchanged by this PR:
maingives18 failed, 426 passed, 4 skippedon thismachine before any edit, and the 3 added tests account for the difference. They are the CLI
stdout-encoding, Windows file-URI and speech-transcription tests that need a UTF-8 console, a
case-sensitive path and network/ffmpeg.
black --checkclean on both files.