DOCX math: degHide is ignored and a hidden radical degree is emitted
I maintainer di solito rispondono entro 1 giorno
@feiiiiii5 ci sta già lavorando.
Dal 1/11/2026.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 30/100
Direzione di ricerca
Start with do_rad in packages/markitdown/src/markitdown/converter_utils/docx/math/omml.py, which picks the indexed root only from whether the degree text is nonempty, and with the radical properties parser that ignores degHide. Run the reproduction snippet from the issue to confirm $\sqrt[3]{x}$ is emitted. Linked PR #2807 is already open for this, so review it before starting. Done means a hidden degree gives \sqrt{x}, the val and bare-element defaults are honored, and visible degrees are unchanged.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
When an OMML radical retains a nonempty m:deg but marks it hidden with m:radPr/m:degHide, DOCX conversion still emits the degree. For example, a radical whose degree 3 is hidden becomes $\sqrt[3]{x}$ instead of $\sqrt{x}$.
This changes the displayed mathematical expression in the Markdown consumed by downstream readers or LLMs. Conversion succeeds without a warning.
Reproduced on current main at 7482c092, reporting version 0.1.9. I searched existing issues and PRs for degHide, hidden degree, radical, and square root and did not find this case.
Reproduction
From a checkout of that commit:
pip install -e "./packages/markitdown[docx]" python-docx
The following creates a synthetic DOCX in memory and uses the public conversion API. No LLM or external service is involved.
import io
from docx import Document
from docx.oxml import parse_xml
from markitdown import MarkItDown, StreamInfo
document = Document()
document.add_paragraph()._p.append(parse_xml("""
<m:oMath xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math">
<m:rad>
<m:radPr><m:degHide m:val="1"/></m:radPr>
<m:deg><m:r><m:t>3</m:t></m:r></m:deg>
<m:e><m:r><m:t>x</m:t></m:r></m:e>
</m:rad>
</m:oMath>
"""))
stream = io.BytesIO()
document.save(stream)
stream.seek(0)
result = MarkItDown(enable_plugins=False).convert_stream(
stream, stream_info=StreamInfo(extension=".docx")
)
print(result.markdown)
# Actual: $\sqrt[3]{x}$
# Expected: $\sqrt{x}$
Expected behavior and controls
Microsoft's HideDegree documentation specifies that degHide=1/true hides the radical degree. A present degHide with no val also means enabled; an absent element means disabled.
I checked the following through both oMath2Latex and serialized DOCX conversion, keeping the stored degree 3 and radicand x constant:
| Radical properties | Expected LaTeX | Actual |
|---|---|---|
<m:degHide m:val="1"/> |
\sqrt{x} |
\sqrt[3]{x} |
<m:degHide m:val="true"/> |
\sqrt{x} |
\sqrt[3]{x} |
<m:degHide/> |
\sqrt{x} |
\sqrt[3]{x} |
<m:degHide m:val="0"/> |
\sqrt[3]{x} |
correct |
<m:degHide m:val="false"/> |
\sqrt[3]{x} |
correct |
<m:radPr/> |
\sqrt[3]{x} |
correct |
no m:radPr |
\sqrt[3]{x} |
correct |
The first five rows place the listed element inside m:radPr.
Likely cause
oMath2Latex.do_rad chooses an indexed root solely from whether the converted degree text is nonempty. It never checks degHide; the properties parser does not read that flag either.
The radical handler should honor the visibility flag and its on/off defaults while preserving the existing visible-degree behavior.
Environment
- macOS 26.4, Apple Silicon; Python 3.13.3
- markitdown 0.1.9 from the commit above
- python-docx 1.2.0, mammoth 1.13.0, lxml 6.1.3
- beautifulsoup4 4.15.0, markdownify 1.2.3
- Lingua principale
- Python
- Stelle
- 194k
- Fork
- 14.5k
- Merge medio
- 24m
- PR unite (30g)
- 7
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/markitdown
-
URL fetch sends default python-requests User-Agent, Wikipedia returns 403Forse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
microsoft/markitdown#2820 ·
I maintainer di solito rispondono entro 1 giorno
-
Valid Atom feeds with zero entries are rejected as an unknown feed typeForse già presa @pujitha24 l’ha presa 6 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
microsoft/markitdown#2781 ·
I maintainer di solito rispondono entro 1 giorno
-
DOCX: footnote references and back-links point to anchors that don't exist in the MarkdownForse già presa @sun04222 l’ha presa 11 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
microsoft/markitdown#2743 ·
I maintainer di solito rispondono entro 1 giorno
-
DOCX math: a delimiter with several arguments keeps only the last oneForse già presa @drakeo338 l’ha presa 33 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
microsoft/markitdown#2573 ·
I maintainer di solito rispondono entro 1 giorno
-
DOCX: Heading 7-9 styles lose heading structure entirely (render as plain paragraphs)Forse già presa @stanleys12 l’ha presa 38 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
microsoft/markitdown#2530 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di microsoft/markitdown
Issue simili
-
HandyModRTransform.deriv3 is wrong for m > 2Forse già presa @SajalDevX l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
read_messages: the first read after subscribe/psubscribe returns no messages even when some are waitingForse già presa @matheussilvano l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
The-Swarm-Corporation/swarms-framework-docs#399 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
bump patch
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
autowarefoundation/autoware_carla_scenario#1321 ·
I maintainer di solito rispondono entro 1 giorno