Reproduced by us · fixed in 0.1.9
DocxConverter threw IndexError with message: pop from empty list
A field-end mark with no matching field-begin mark in the document made the DOCX reader (mammoth before 1.12.2) pop from an empty list.
Formats
Word is where MarkItDown is strongest, because a DOCX file really does contain headings, lists and tables. We built one test file per feature, converted each with version 0.1.9 and judged the result against the Markdown it should have produced: of 35 Word features, 19 were kept, 13 changed and 3 lost (one more row is the legacy .doc case).
Short answer
Install the extra, convert, save with -o:
pip install "markitdown[pdf]"markitdown report.docx -o report.md(Use docx instead of pdf in the first command.) Headings, emphasis, lists, links and tables come through. Check table header rows, cells that contain |, the document title, nested bullets and images.
Tested with markitdown 0.1.9 · Python 3.13 · markitdown[all] 0.1.9 · Linux lab; the DOCX corpus also ran on Windows, macOS and Ubuntu runners (T03, T05) · LibreOffice 24.2, Pandoc 3.1 for building test files · 2026-11-15 · evidence: office-features.csv, format-matrix.csv, docx-features.jsonl
Kept means the Markdown matches what the feature should produce; changed means it survives but differently; lost means it is not in the output.
| Feature | Result | What came out | Note |
|---|---|---|---|
| Title and Subtitle styles | lost | The Document Title↵↵A subtitle line↵↵# First section↵↵Body text. | Title is a paragraph style, not a heading. missing: ['# The Document Title'] |
| Heading levels 1 to 6 | kept | # Heading level 1↵↵## Heading level 2↵↵### Heading level 3↵↵#### Heading level 4↵↵##### Heading level 5↵↵###### Heading level 6 | |
| Bold, italic, underline, strike | kept | **bold** *italic* <u>underlined</u> ~~struck~~ x2 H2 | Underline and strike come out as HTML-style or Markdown markers; see the excerpt. |
| Underline, strike, superscript, subscript | changed | **bold** *italic* <u>underlined</u> ~~struck~~ x2 H2 | Underline becomes <u>…</u>, strike becomes ~~…~~; check superscript and subscript in the excerpt: kept as plain digits |
| Hyperlink | kept | See [the example page](https://example.org/page) for details. | |
| Nested bullets by paragraph style | changed | * Top one↵* Second level↵* Third level↵* Top two | Compare the indentation of the three levels. missing: [' * Second level', ' * Third level'] |
| Numbered list by paragraph style | changed | 1. First↵2. Second↵3. Nested number↵4. Third | missing: ['3. Third'] |
| Nested bullets with list levels | kept | * Top one↵ + Second level↵ - Third level↵* Top two | Real list levels survive; the bullet character alternates (* + -). |
| Numbered list with list levels | kept | 1. First↵ 1. Nested↵2. Second↵3. Third | |
| Table with a marked header row | kept | | Station | Rainfall | Notes |↵| --- | --- | --- |↵| Alpha | 412.5 | ok |↵| Bravo | 388.0 | low | | Check whether the first line of the table is the header or an empty row. |
| Table without a header-row flag | changed | | | | |↵| --- | --- | --- |↵| Station | Rainfall | Notes |↵| Alpha | 412.5 | ok |↵| Bravo | 388.0 | low | | The flag set in Word (Table Design, Header Row, Repeat as header) decides whether the header is real. the table starts with an empty header row; the real first row is the second line. |
| Title style mapped to a heading | kept | # The Document Title↵↵A subtitle line↵↵# First section↵↵Body text. | style_map is a constructor argument. |
| Subtitle style mapped to a second-level heading | kept | # The Document Title↵↵## A subtitle line↵↵# First section↵↵Body text. | |
| Merged cells | changed | | | | |↵| --- | --- | --- |↵| Merged title across three columns | | |↵| A | B | C |↵| 1 | 2 | 3 | | the table starts with an empty header row; the real first row is the second line. |
| A pipe character inside a cell | changed | | | |↵| --- | --- |↵| Key | Value |↵| state | OK | stable | | An unescaped | adds a column. the pipe is not escaped, so the row gets an extra cell |
| Pipe workaround: escape the pipe in the file first | changed | | | |↵| --- | --- |↵| Key | Value |↵| state | OK \| stable | | Edits the DOCX XML (script in the page); the document shown to the reader is unchanged. the table starts with an empty header row; the real first row is the second line. |
| Multi-paragraph cell | changed | | | |↵| --- | --- |↵| Name | Details |↵| Alpha | first paragraph second paragraph | | the table starts with an empty header row; the real first row is the second line. |
| Nested table | changed | | | | | | | |↵| --- | --- | --- | --- | --- | --- |↵| outer left | | | | | --- | --- | | in1 | in2 | | in3 | in4 | | | the table starts with an empty header row; the real first row is the second line. |
| Wide table (12 columns) | changed | | | | | | | | | | | | | |↵| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |↵| H1 | H2 | H3 | H4 | H5 | H6 | H7 | H | the table starts with an empty header row; the real first row is the second line. |
| Embedded picture, no alt text | kept | ↵↵After | By default the image data is cut off; see keep_data_uris. |
| Embedded picture with alt text | kept |  | The alt text is used as the Markdown alt text. |
| keep_data_uris on a picture | kept | Before↵↵ | kept | Kept text inserted words | Deleted text should not appear. |
| Custom styles without a mapping | kept | print('hello')↵↵A key phrase inside text. | Unmapped custom styles come out as ordinary text. |
| Custom paragraph style mapped to code | kept | print('hello')↵```↵↵A key phrase inside text. | |
| Custom character style mapped to emphasis | kept | A *key phrase* inside text. | |
| Footnotes | changed | A sentence with a note.[[1]](#footnote-20)↵↵1. The footnote text itself. [↑](#footnote-ref-20) | Footnote text is in a separate part of the file. the reference becomes a link to #footnote-N and the note text is a numbered list at the end |
| Table of contents | kept | # One↵↵text↵↵# Two↵↵text↵↵## Two point one↵↵text | |
| Equation | kept | Inline $x^{2}+y^{2}=z^{2}$ and display:↵↵$$\frac{a}{b}=c$$ | Equations are converted to LaTeX when markitdown can read the Office Math. |
| Block quote and code block | changed | A quoted line.↵↵code line one↵code line two | Code blocks have no fence; check the excerpt. missing: ['> A quoted line.'] |
| Right-to-left text | kept | مرحبا بالعالم עברית | |
| Document written by LibreOffice | changed | # LO Title↵↵* one↵ + two↵ - three↵↵1. a↵2. b↵↵| | |↵| --- | --- |↵| H | V |↵| 1 | 2 | | The 'w:ilvl' KeyError reported upstream concerns non-Word writers; we record what this file does. the table starts with an empty header row; the real first row is the second line. |
The synthetic report from the quickstart, with each part of the output tied to the region it came from:
5 headings → 4 kept, 1 changed · 1 paragraph → 1 kept · 2 lists → 2 kept · 1 table → 1 kept
Input · report.docx
Output · markitdown report.docx
Pilot Report: Field Station Alpha
# 1. Summary
This report covers **three sites** during *spring 2026* <u>with underlined</u> ~~and struck text.~~
## 1.1 Key findings
* Rainfall rose 12% year on year
* Sensor uptime reached 99.2%
* Two stations need new batteries
* Nested item under batteries
## 1.2 Next steps
1. Order batteries
2. Recalibrate sensors
3. Publish dataset
# 2. Measurements
| | | | |
| --- | --- | --- | --- |
| Station | Rainfall (mm) | Uptime | Notes |
| Alpha | 412.5 | 99.2% | Battery low |
| Bravo | 388.0 | 97.8% | OK | stable |
| Charlie | 451.3 | 99.9% | New sensor |
## 2.1 Chart

Figure 1: Quarterly revenue chart.
### 3. Deep heading level three
Contact: hello@example.org — see https://example.org/data for the dataset. Unicode check: café, naïve, 東京, Ω, emoji 🙂.
On our 15-file Word corpus (real files from other tools plus synthetic ones) the grades were 4 A, 7 B, 2 C and 2 X, the two X being a corrupt file and a zero-byte file (grading method).
The document is turned into HTML by the Mammoth library using Word styles, and the HTML is turned into Markdown. So what matters is the style applied in Word, not how the text looks: a line made big and bold by hand is a paragraph; a line in the Heading 2 style is a ##.
Paragraphs in the Title and Subtitle styles come out as plain paragraphs:
The Document Title
A subtitle line
# First section
Body text.The Document Title
A subtitle line
First section
Body text.
Mapping the styles fixes it (the full mechanism is below):
# The Document Title
## A subtitle line
# First section
Body text.The Document Title
A subtitle line
First section
Body text.
A table whose first row is not flagged as a header row in Word gets an empty header line, with the real header as the first data row:
| | | |
| --- | --- | --- |
| Station | Rainfall | Notes |
| Alpha | 412.5 | ok |
| Bravo | 388.0 | low || Station | Rainfall | Notes |
| Alpha | 412.5 | ok |
| Bravo | 388.0 | low |
The same table with the flag set (Table Design, Header Row, then Repeat as header row) comes out right:
| Station | Rainfall | Notes |
| --- | --- | --- |
| Alpha | 412.5 | ok |
| Bravo | 388.0 | low || Station | Rainfall | Notes |
|---|---|---|
| Alpha | 412.5 | ok |
| Bravo | 388.0 | low |
Merged cells, multi-paragraph cells, nested tables and a 12-column table all produced a table with the empty header row; the merged title appeared once in its first cell and the other cells were empty (sample files: no header flag, header flag).
| inside a cell breaks the rowUnlike the CSV converter, Word cell text is not escaped, so OK | stable adds a column:
| | |
| --- | --- |
| Key | Value |
| state | OK | stable || Key | Value |
| state | OK |
The workaround we tested is to escape the pipe in the file before converting; it produced OK \| stable:
| | |
| --- | --- |
| Key | Value |
| state | OK \| stable || Key | Value |
| state | OK | stable |
The recipe is in lab/scripts/t07_docx.py (escape_pipes).
It depends on how the list was made. Real multi-level lists (what Word produces) keep their nesting, with the bullet character alternating *, +, -:
* Top one
+ Second level
- Third level
* Top twoLists built by applying a different paragraph style to each line (List Bullet 2, List Bullet 3) are flattened to one level:
* Top one
* Second level
* Third level
* Top twoNumbered lists with real levels come out as 1. 2. 3. with the nested item indented; the style-based version numbers the nested item as a fourth top-level item. Sample with list levels, sample with styles.
Each embedded picture becomes : the data is cut off, and the alt text, when the picture has one, is kept:
[image]
With keep_data_uris=True the full base64 stays (our file's output grew from 44 to 11,246 characters). Extracting pictures to files and descriptions: image page.
style_mapstyle_map is a Mammoth style-mapping rule list passed to the constructor, so it is Python only: there is no command-line option for it (CLI reference). Three tested mappings, applied together:
from markitdown import MarkItDown
# Title and Subtitle paragraph styles, a custom paragraph style and a custom character style
rules = "\n".join([
"p[style-name='Title'] => h1:fresh",
"p[style-name='Subtitle'] => h2:fresh",
"p[style-name='CodeBlock'] => pre:fresh",
"r[style-name='Highlight Phrase'] => em",
])
md = MarkItDown(style_map=rules)
print(md.convert("samples/docx-title-subtitle.docx").markdown.split("\n\n")[0:2])
print(md.convert("samples/docx-custom-styles.docx").markdown)['# The Document Title', '## A subtitle line']
```
print('hello')
```
A *key phrase* inside text. Without a mapping, custom styles come out as ordinary text:
print('hello')
A key phrase inside text.print('hello')
A key phrase inside text.
A mapping cannot infer headings from appearance and does not affect tables. We did not test how rules embedded in the document interact with yours. Sample with the custom styles.
#footnote-N and the note is a numbered list at the end.A sentence with a note.[[1]](#footnote-20)
1. The footnote text itself. [↑](#footnote-ref-20)A sentence with a note.[1]
Word equations come out as LaTeX between $ for inline and $$ for display:
Inline $x^{2}+y^{2}=z^{2}$ and display:
$$\frac{a}{b}=c$$Inline $x^{2}+y^{2}=z^{2}$ and display:
$$\frac{a}{b}=c$$
.doc filesA .doc file raises UnsupportedFormatException. The route we tested: convert it to .docx with LibreOffice in headless mode, then MarkItDown. The result was identical to converting the original DOCX:
soffice --headless --convert-to docx report.docSeveral files: batch conversion. .rtf and .odt: the formats page.
Reproduced by us · fixed in 0.1.9
A field-end mark with no matching field-begin mark in the document made the DOCX reader (mammoth before 1.12.2) pop from an empty list.
Affected: 0.1.6 and 0.1.8 (tested; mammoth 1.11) · last reproduced 2026-11-15 · Upstream report
Reported, not reproduced by us
Reported for DOCX files written by tools other than Word; the underlying DOCX reader (mammoth) fails on a numbering definition it does not expect.
Affected: reported on 0.1.x · Upstream report
A file written by LibreOffice, with nested lists and a table, converted without an error in our test (row W25); we could not produce the w:ilvl error ourselves.
LibreOffice files convert, with nested lists intact and the same empty table header row. We did not have Google Docs or Pages exports to test, so we make no claim about them.
We built the test files for this page with Pandoc but did not compare its conversion with MarkItDown's. MarkItDown is one tool for many formats and returns text meant for language models: the comparison.