Repository navigation
fix(pptx): preserve native Office Math equations - #4625
Merged
PeterStaar-IBM merged 1 commit intoOct 7, 2026
Merged
Conversation
Signed-off-by: Raul Ernesto Guillen Hernandez <37725305+RauPro@users.noreply.github.com>
Contributor
|
✅ DCO Check Passed Thanks @RauPro, all your commits are properly signed off. 🎉 |
Contributor
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
avanish-garg
added a commit
to avanish-garg/docling
that referenced
this pull request
Oct 7, 2026
The PPTX text-extraction loop built each paragraph's text via plain
string concatenation (p_text += e.text) and handed the whole thing to
a single add_text/add_list_item call, discarding every run's own
hyperlink and bold/italic/underline formatting - the same information
DOCX/HTML/ODF/MD backends already preserve per run.
Splits each paragraph into (text, formatting, hyperlink) tuples per
run, mirroring msword_backend.py's existing _iter_paragraph_content/
_get_format_from_run/_get_hyperlink_target pattern:
- Adjacent runs with identical formatting/hyperlink are coalesced back
into one unit first, since PowerPoint sometimes splits a single word
across runs with no actual formatting difference (e.g. spell-check
markup) - without this, wrapping each such run in its own item would
let the markdown serializer's inter-sibling space split real words.
- A paragraph with more than one run is wrapped in an inline group
(mirroring the DOCX backend's own _create_or_reuse_parent), so a
sentence with a bold word or a link in the middle stays one flowing
unit on export instead of splintering into separate blocks.
- Title/section-header paragraphs are kept as a single item as before:
a heading is one outline-level unit, not a sequence of independently
formatted spans.
- Each item's own provenance is now built from its own text rather
than the whole paragraph's, so charspan stays correct once a
paragraph can produce more than one item (python-pptx exposes no
finer bbox than the shape's, so the bbox itself stays shape-level).
New test: test_pptx_preserves_run_level_formatting_and_hyperlinks,
covering a bold run, a plain run, and a hyperlinked run in one
paragraph. Golden fixtures regenerated; diffs are exactly the fixed
behavior (a real markdown hyperlink where the URL was silently
dropped, formatting: {...} now present throughout) with no unrelated
changes.
Native Office Math equations (docling-project#4625) keep their own FORMULA items; the text
runs around them now carry their run-level formatting and hyperlinks too.
Signed-off-by: Avanish Garg <gargavanish@gmail.com>
avanish-garg
added a commit
to avanish-garg/docling
that referenced
this pull request
Oct 8, 2026
The PPTX text-extraction loop built each paragraph's text via plain
string concatenation (p_text += e.text) and handed the whole thing to
a single add_text/add_list_item call, discarding every run's own
hyperlink and bold/italic/underline formatting - the same information
DOCX/HTML/ODF/MD backends already preserve per run.
Splits each paragraph into (text, formatting, hyperlink) tuples per
run, mirroring msword_backend.py's existing _iter_paragraph_content/
_get_format_from_run/_get_hyperlink_target pattern:
- Adjacent runs with identical formatting/hyperlink are coalesced back
into one unit first, since PowerPoint sometimes splits a single word
across runs with no actual formatting difference (e.g. spell-check
markup) - without this, wrapping each such run in its own item would
let the markdown serializer's inter-sibling space split real words.
- A paragraph with more than one run is wrapped in an inline group
(mirroring the DOCX backend's own _create_or_reuse_parent), so a
sentence with a bold word or a link in the middle stays one flowing
unit on export instead of splintering into separate blocks.
- Title/section-header paragraphs are kept as a single item as before:
a heading is one outline-level unit, not a sequence of independently
formatted spans.
- Each item's own provenance is now built from its own text rather
than the whole paragraph's, so charspan stays correct once a
paragraph can produce more than one item (python-pptx exposes no
finer bbox than the shape's, so the bbox itself stays shape-level).
New test: test_pptx_preserves_run_level_formatting_and_hyperlinks,
covering a bold run, a plain run, and a hyperlinked run in one
paragraph. Golden fixtures regenerated; diffs are exactly the fixed
behavior (a real markdown hyperlink where the URL was silently
dropped, formatting: {...} now present throughout) with no unrelated
changes.
Native Office Math equations (docling-project#4625) keep their own FORMULA items; the text
runs around them now carry their run-level formatting and hyperlinks too.
Signed-off-by: Avanish Garg <gargavanish@gmail.com>
avanish-garg
added a commit
to avanish-garg/docling
that referenced
this pull request
Oct 9, 2026
The PPTX text-extraction loop built each paragraph's text via plain
string concatenation (p_text += e.text) and handed the whole thing to
a single add_text/add_list_item call, discarding every run's own
hyperlink and bold/italic/underline formatting - the same information
DOCX/HTML/ODF/MD backends already preserve per run.
Splits each paragraph into (text, formatting, hyperlink) tuples per
run, mirroring msword_backend.py's existing _iter_paragraph_content/
_get_format_from_run/_get_hyperlink_target pattern:
- Adjacent runs with identical formatting/hyperlink are coalesced back
into one unit first, since PowerPoint sometimes splits a single word
across runs with no actual formatting difference (e.g. spell-check
markup) - without this, wrapping each such run in its own item would
let the markdown serializer's inter-sibling space split real words.
- A paragraph with more than one run is wrapped in an inline group
(mirroring the DOCX backend's own _create_or_reuse_parent), so a
sentence with a bold word or a link in the middle stays one flowing
unit on export instead of splintering into separate blocks.
- Title/section-header paragraphs are kept as a single item as before:
a heading is one outline-level unit, not a sequence of independently
formatted spans.
- Each item's own provenance is now built from its own text rather
than the whole paragraph's, so charspan stays correct once a
paragraph can produce more than one item (python-pptx exposes no
finer bbox than the shape's, so the bbox itself stays shape-level).
New test: test_pptx_preserves_run_level_formatting_and_hyperlinks,
covering a bold run, a plain run, and a hyperlinked run in one
paragraph. Golden fixtures regenerated; diffs are exactly the fixed
behavior (a real markdown hyperlink where the URL was silently
dropped, formatting: {...} now present throughout) with no unrelated
changes.
Native Office Math equations (docling-project#4625) keep their own FORMULA items; the text
runs around them now carry their run-level formatting and hyperlinks too.
Signed-off-by: Avanish Garg <gargavanish@gmail.com>
avanish-garg
added a commit
to avanish-garg/docling
that referenced
this pull request
Oct 14, 2026
The PPTX text-extraction loop built each paragraph's text via plain
string concatenation (p_text += e.text) and handed the whole thing to
a single add_text/add_list_item call, discarding every run's own
hyperlink and bold/italic/underline formatting - the same information
DOCX/HTML/ODF/MD backends already preserve per run.
Splits each paragraph into (text, formatting, hyperlink) tuples per
run, mirroring msword_backend.py's existing _iter_paragraph_content/
_get_format_from_run/_get_hyperlink_target pattern:
- Adjacent runs with identical formatting/hyperlink are coalesced back
into one unit first, since PowerPoint sometimes splits a single word
across runs with no actual formatting difference (e.g. spell-check
markup) - without this, wrapping each such run in its own item would
let the markdown serializer's inter-sibling space split real words.
- A paragraph with more than one run is wrapped in an inline group
(mirroring the DOCX backend's own _create_or_reuse_parent), so a
sentence with a bold word or a link in the middle stays one flowing
unit on export instead of splintering into separate blocks.
- Title/section-header paragraphs are kept as a single item as before:
a heading is one outline-level unit, not a sequence of independently
formatted spans.
- Each item's own provenance is now built from its own text rather
than the whole paragraph's, so charspan stays correct once a
paragraph can produce more than one item (python-pptx exposes no
finer bbox than the shape's, so the bbox itself stays shape-level).
New test: test_pptx_preserves_run_level_formatting_and_hyperlinks,
covering a bold run, a plain run, and a hyperlinked run in one
paragraph. Golden fixtures regenerated; diffs are exactly the fixed
behavior (a real markdown hyperlink where the URL was silently
dropped, formatting: {...} now present throughout) with no unrelated
changes.
Native Office Math equations (docling-project#4625) keep their own FORMULA items; the text
runs around them now carry their run-level formatting and hyperlinks too.
Signed-off-by: Avanish Garg <gargavanish@gmail.com>
3 tasks done
avanish-garg
added a commit
to avanish-garg/docling
that referenced
this pull request
Nov 11, 2026
The PPTX text-extraction loop built each paragraph's text via plain
string concatenation (p_text += e.text) and handed the whole thing to
a single add_text/add_list_item call, discarding every run's own
hyperlink and bold/italic/underline formatting - the same information
DOCX/HTML/ODF/MD backends already preserve per run.
Splits each paragraph into (text, formatting, hyperlink) tuples per
run, mirroring msword_backend.py's existing _iter_paragraph_content/
_get_format_from_run/_get_hyperlink_target pattern:
- Adjacent runs with identical formatting/hyperlink are coalesced back
into one unit first, since PowerPoint sometimes splits a single word
across runs with no actual formatting difference (e.g. spell-check
markup) - without this, wrapping each such run in its own item would
let the markdown serializer's inter-sibling space split real words.
- A paragraph with more than one run is wrapped in an inline group
(mirroring the DOCX backend's own _create_or_reuse_parent), so a
sentence with a bold word or a link in the middle stays one flowing
unit on export instead of splintering into separate blocks.
- Title/section-header paragraphs are kept as a single item as before:
a heading is one outline-level unit, not a sequence of independently
formatted spans.
- Each item's own provenance is now built from its own text rather
than the whole paragraph's, so charspan stays correct once a
paragraph can produce more than one item (python-pptx exposes no
finer bbox than the shape's, so the bbox itself stays shape-level).
New test: test_pptx_preserves_run_level_formatting_and_hyperlinks,
covering a bold run, a plain run, and a hyperlinked run in one
paragraph. Golden fixtures regenerated; diffs are exactly the fixed
behavior (a real markdown hyperlink where the URL was silently
dropped, formatting: {...} now present throughout) with no unrelated
changes.
Native Office Math equations (docling-project#4625) keep their own FORMULA items; the text
runs around them now carry their run-level formatting and hyperlinks too.
Signed-off-by: Avanish Garg <gargavanish@gmail.com>
avanish-garg
added a commit
to avanish-garg/docling
that referenced
this pull request
Nov 26, 2026
The PPTX text-extraction loop built each paragraph's text via plain
string concatenation (p_text += e.text) and handed the whole thing to
a single add_text/add_list_item call, discarding every run's own
hyperlink and bold/italic/underline formatting - the same information
DOCX/HTML/ODF/MD backends already preserve per run.
Splits each paragraph into (text, formatting, hyperlink) tuples per
run, mirroring msword_backend.py's existing _iter_paragraph_content/
_get_format_from_run/_get_hyperlink_target pattern:
- Adjacent runs with identical formatting/hyperlink are coalesced back
into one unit first, since PowerPoint sometimes splits a single word
across runs with no actual formatting difference (e.g. spell-check
markup) - without this, wrapping each such run in its own item would
let the markdown serializer's inter-sibling space split real words.
- A paragraph with more than one run is wrapped in an inline group
(mirroring the DOCX backend's own _create_or_reuse_parent), so a
sentence with a bold word or a link in the middle stays one flowing
unit on export instead of splintering into separate blocks.
- Title/section-header paragraphs are kept as a single item as before:
a heading is one outline-level unit, not a sequence of independently
formatted spans.
- Each item's own provenance is now built from its own text rather
than the whole paragraph's, so charspan stays correct once a
paragraph can produce more than one item (python-pptx exposes no
finer bbox than the shape's, so the bbox itself stays shape-level).
New test: test_pptx_preserves_run_level_formatting_and_hyperlinks,
covering a bold run, a plain run, and a hyperlinked run in one
paragraph. Golden fixtures regenerated; diffs are exactly the fixed
behavior (a real markdown hyperlink where the URL was silently
dropped, formatting: {...} now present throughout) with no unrelated
changes.
Native Office Math equations (docling-project#4625) keep their own FORMULA items; the text
runs around them now carry their run-level formatting and hyperlinks too.
Signed-off-by: Avanish Garg <gargavanish@gmail.com>
avanish-garg
added a commit
to avanish-garg/docling
that referenced
this pull request
Dec 3, 2026
The PPTX text-extraction loop built each paragraph's text via plain
string concatenation (p_text += e.text) and handed the whole thing to
a single add_text/add_list_item call, discarding every run's own
hyperlink and bold/italic/underline formatting - the same information
DOCX/HTML/ODF/MD backends already preserve per run.
Splits each paragraph into (text, formatting, hyperlink) tuples per
run, mirroring msword_backend.py's existing _iter_paragraph_content/
_get_format_from_run/_get_hyperlink_target pattern:
- Adjacent runs with identical formatting/hyperlink are coalesced back
into one unit first, since PowerPoint sometimes splits a single word
across runs with no actual formatting difference (e.g. spell-check
markup) - without this, wrapping each such run in its own item would
let the markdown serializer's inter-sibling space split real words.
- A paragraph with more than one run is wrapped in an inline group
(mirroring the DOCX backend's own _create_or_reuse_parent), so a
sentence with a bold word or a link in the middle stays one flowing
unit on export instead of splintering into separate blocks.
- Title/section-header paragraphs are kept as a single item as before:
a heading is one outline-level unit, not a sequence of independently
formatted spans.
- Each item's own provenance is now built from its own text rather
than the whole paragraph's, so charspan stays correct once a
paragraph can produce more than one item (python-pptx exposes no
finer bbox than the shape's, so the bbox itself stays shape-level).
New test: test_pptx_preserves_run_level_formatting_and_hyperlinks,
covering a bold run, a plain run, and a hyperlinked run in one
paragraph. Golden fixtures regenerated; diffs are exactly the fixed
behavior (a real markdown hyperlink where the URL was silently
dropped, formatting: {...} now present throughout) with no unrelated
changes.
Native Office Math equations (docling-project#4625) keep their own FORMULA items; the text
runs around them now carry their run-level formatting and hyperlinks too.
Signed-off-by: Avanish Garg <gargavanish@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PowerPoint text extraction skips Office Math elements, so equations disappear from equation-only shapes and mixed paragraphs. Read OMML in paragraph order and reuse the existing Office Math to LaTeX converter. Standalone equations become formula items; mixed paragraphs and list items contain inline formula items. For
mc:AlternateContent, read one supported choice or its fallback to avoid duplicate output. Mixed title paragraphs retain their title label.The
format-pptxextra now includespylatexenc, which the shared converter requires. The lockfile changes only the corresponding dependency entries.Issue resolved by this Pull Request:
Resolves #4603
Checklist:
Review evidence:
a14:m/m:oMathcontent that was absent from both the document tree and Markdown now appears once as a formula. Tests also cover wrapped equations, the fallback for unsupported compatibility choices, text/formula order, list parents, fractions, and title labels.python -m pytest -p no:tach tests/test_backend_pptx.py tests/test_backend_pptx_math.py -q: 39 passed.make validate: passed with the isolated test environment (UV_PROJECT_ENVIRONMENT=../venv,UV_NO_SYNC=1). All applicable hooks passed, including Ruff, ty, Tach and the lockfile check.uv lock --locked --offline: passed.Prepared with assistance from OpenAI Codex.