microsoft / microsoft/markitdown

Support mammoth options in docx converter

Open
#1,549 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

My specific issue is that two adjacent lists end up getting combined together along the process of docx --> html --> markdown.

As in:

1. Item 1
2. Item 2
3. Item 3

1. Item 1
2. Item 2
3. Item 3

in the docx end up converted as:

1. Item 1
2. Item 2
3. Item 3
4. Item 1
5. Item 2
6. Item 3

one way around this is to pass in ignore_empty_paragraphs=False into mammoth.convert_to_html so that the blank line between the lists ends up as <p></p>, which then causes markdownify to separate the lists properly. However, the DocxConverter does not allow for passing any options into mammoth.convert_to_html other than custom style maps.

Possible related issue

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 at DocxConverter and inspect its call to mammoth.convert_to_html, including how custom style maps are passed. Reproduce the adjacent-list DOCX-to-HTML-to-Markdown case, then verify that an option such as ignore_empty_paragraphs=False can be forwarded and keeps the lists separate.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
content
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.