microsoft / microsoft/markitdown

[EPUB] Noisy Markdown output (XML/CSS) and missing chapters due to path resolution issues

Open
#1,724 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
186k
Forks
13.7k
Avg merge
1d 4h
Merged PRs (30d)
49

Description

Description

Currently, the _epub_converter.py in MarkItDown has two significant limitations when handling EPUB files:

  • Noise in output: XHTML files often include XML declarations and <style> blocks. If the BeautifulSoup search for <body> fails (common with namespaces), the entire raw file content is included in the Markdown output.
  • Missing Content: The simplistic path joining logic f"{base_path}/{manifest[item_id]}" fails to correctly resolve relative paths (e.g., ../Text/...) used in many commercial EPUB manifests.
Potential Solution

A more robust manifest parser that handles relative paths and a more aggressive XHTML cleaner would resolve these issues. I have implemented a workaround for a private project and would be happy to contribute a PR if interested.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading _epub_converter.py, especially the BeautifulSoup body search and manifest path construction. Reproduce the issue with EPUB files containing namespaced XHTML, XML or style noise, and relative paths such as ../Text/.... Done means Markdown excludes that noise and includes chapters whose manifest paths require relative resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.