DOCX math: degHide is ignored and a hidden radical degree is emitted
メンテナーはふだん 1 日以内に返信
@feiiiiii5 がすでに取り組んでいます。
2026年11月1日 から。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Python
- スター
- 194k
- フォーク
- 14.5k
- 平均マージ
- 1時間 43分
- マージ済み PR(30日)
- 8
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/markitdown のほかの issue
-
DOCX: math pre-processing re-parses every document.xml even without equations (32 s -> 17.5 s on a 12.5 MB document)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 89/100
microsoft/markitdown#2834 ·
メンテナーはふだん 1 日以内に返信
-
URL fetch sends default python-requests User-Agent, Wikipedia returns 403対応中かも @sushan5140 が 4 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
microsoft/markitdown#2820 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Valid Atom feeds with zero entries are rejected as an unknown feed type対応中かも @pujitha24 が 10 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/markitdown#2781 ·
メンテナーはふだん 1 日以内に返信
-
DOCX: footnote references and back-links point to anchors that don't exist in the Markdown対応中かも @sun04222 が 14 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
microsoft/markitdown#2743 ·
メンテナーはふだん 1 日以内に返信
-
DOCX math: a delimiter with several arguments keeps only the last one対応中かも @drakeo338 が 37 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
microsoft/markitdown#2573 ·
メンテナーはふだん 1 日以内に返信
microsoft/markitdown の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
RunestoneInteractive/rs#1661 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
streamlink/streamlink#7192 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
aws-samples/sample-per-model-bedrock#795 ·
メンテナーはふだん 1 日以内に返信