What I hit
Converting DOCX to Markdown via anydoc, I got "1. 1. text" instead of
"1. text" on numbered lists. Took me a while to figure out why — the
test fixtures all use clean numPr-only numbering, so they pass, and
the bug only shows up when the source also hardcodes the prefix into
w:t.
Why it happens
OOXML lets a list item carry numbering in two places at once:
w:numPr (the model) and w:t (literal text). When both are present,
anydoc's render_list emits a prefix and the text already has one, so
you get the prefix twice.
This pattern is common in files from python-docx, docx.js, and any
AI agent writing DOCX today — they tend to bake the visible prefix
into the text run alongside numPr. Same for some Microsoft Word and
WPS exports, and copy-paste across editors.
Repro
Files with this in their body:
<w:p>
<w:pPr><w:numPr><w:ilvl/><w:numId/></w:numPr></w:pPr>
<w:r><w:t>1. first item</w:t></w:r>
</w:p>
Anyone running anydoc on those gets "1. 1. first item" in the output,
which breaks anything downstream that reads Markdown.
Scope
Ordered lists only (decimal, alpha, roman, composite labels like
"1.1)"). Bullets are fine. LibreOffice and anydoc's own fixtures
don't trigger this because they keep w:t clean.
Fix
PR #80. strip_list_num_prefix() detects a leading prefix in the
paragraph text and removes it before rendering, so the prefix only
shows up once.
What I hit
Converting DOCX to Markdown via anydoc, I got "1. 1. text" instead of
"1. text" on numbered lists. Took me a while to figure out why — the
test fixtures all use clean numPr-only numbering, so they pass, and
the bug only shows up when the source also hardcodes the prefix into
w:t.
Why it happens
OOXML lets a list item carry numbering in two places at once:
w:numPr (the model) and w:t (literal text). When both are present,
anydoc's render_list emits a prefix and the text already has one, so
you get the prefix twice.
This pattern is common in files from python-docx, docx.js, and any
AI agent writing DOCX today — they tend to bake the visible prefix
into the text run alongside numPr. Same for some Microsoft Word and
WPS exports, and copy-paste across editors.
Repro
Files with this in their body:
<w:p>
<w:pPr><w:numPr><w:ilvl/><w:numId/></w:numPr></w:pPr>
<w:r><w:t>1. first item</w:t></w:r>
</w:p>
Anyone running anydoc on those gets "1. 1. first item" in the output,
which breaks anything downstream that reads Markdown.
Scope
Ordered lists only (decimal, alpha, roman, composite labels like
"1.1)"). Bullets are fine. LibreOffice and anydoc's own fixtures
don't trigger this because they keep w:t clean.
Fix
PR #80. strip_list_num_prefix() detects a leading prefix in the
paragraph text and removes it before rendering, so the prefix only
shows up once.