Repository navigation
Conversation
Signed-off-by: its-amann <[email protected]>
|
✅ DCO Check Passed Thanks @its-amann, all your commits are properly signed off. 🎉 |
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/
|
AI triage (advisory)Checked commit The PR changes the DOCX backend so that headings with inline equations build an empty CI safety: no concern found. A maintainer must still approve CI. 1 related pull request(s) in the same code
The |
There was a problem hiding this comment.
AI first review (advisory): no blocker found
This review covers the full diff at 2b092d5642. It read the code and did not run it.
The change turns a heading with an equation into an empty SectionHeaderItem with an InlineGroup child. Consumers that read heading.text now get an empty string. The new tests also seem to need an unreleased docling-core change that the lock file does not contain.
A maintainer makes the merge decision. This review never approves the pull request.
| hd = doc.add_heading( | ||
| parent=self.parents[parent_level], | ||
| text=text, | ||
| text="" if equations else text, |
There was a problem hiding this comment.
question: Headings with equations now have empty text, and the tests may need an unreleased docling-core
A heading with an inline equation is now stored with text="" and orig="", and its content moves to an InlineGroup child. Anything that reads SectionHeaderItem.text now sees an empty title. Examples are JSON consumers, chunkers that use heading text as context, and any code that builds a table of contents. Before this change they saw the heading text with <eq> markers. The author says the Markdown and HTML heading output is correct only with the companion core PR (docling-core#933). The PR also says this core change is needed when a rich heading has body children. The new test test_heading_equation_has_inline_content always adds a body paragraph under the heading, and it asserts "$y=2$" in markdown. I could not read the installed docling-core source. uv.lock pins docling-core 2.104.0 and pyproject.toml allows >=2.103.1. Please answer three points: (1) Does the new test pass on the pinned core version, or does it need the unreleased core PR? If it needs the core PR, raise the docling-core minimum version in this PR, or merge after the core release. (2) Which exports and chunkers did you check with an empty heading.text? (3) Is the empty text intended for every consumer, or only for the Markdown and HTML serializers?
There was a problem hiding this comment.
@ceberam the empty heading.text is intentional and follows the representation you requested in #5034. The text and equation remain in the leading inline group, including after a JSON round trip. Direct .text consumers need to read that rich content or use a serializer.
I checked the original 10 tests on pinned core 2.104.0: they pass, but the Markdown assertion only checked that the equation appeared somewhere. Parser tests now check the tree and JSON content. All 312 Word tests pass on 2.104.0, and the focused tests also pass on the minimum 2.103.1. The stronger export tests live in docling-core#933, which now also fixes chunk context and TOC titles. I checked Markdown, HTML, plain text, DocTags, JSON round trips, TOC formats and both Hierarchical/Hybrid chunkers.
I've kept this PR in draft until the core fix is released. The minimum core dependency and lock file will need that released version before merging; I haven't pinned an unpublished version.
Signed-off-by: its-amann <[email protected]>
There was a problem hiding this comment.
AI first review (advisory): no blocker found
This review covers the changes since 2b092d5642 at a3771408b8. It read the code and did not run it.
The change makes a heading with an equation have empty text and an InlineGroup child. The installed docling-core Markdown serializer only reads that group when the heading has exactly one child, because it checks len(item.children) == 1. A heading with body content under it has more children, so it will export wrongly until docling-core#933 is released. The reviewer must decide whether to merge before that release and before pyproject.toml requires it. The tests in the last push only check the tree.
Earlier findings
- open (question): Headings with equations now have empty
text, and exports may need an unreleaseddocling-core
A maintainer makes the merge decision. This review never approves the pull request.
|
@its-amann Is this ready for review? |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Thanks for checking, @PeterStaar-IBM. I've marked this ready for review. The parser changes can be reviewed now. For merge, this still needs a release containing docling-project/docling-core#933 so headings with body content export correctly. Once that release is out, I'll bump the minimum core version and update the lockfile here. |
|
@its-amann Indeed, we should first merge docling-project/docling-core#933 , launch a new release of |
|
@ceberam thanks for merging docling core 933. is a core release planned soon? i'll bump the minimum version here right after |
Word headings containing inline equations keep internal
<eq>markers in their text. This builds the emptySectionHeaderItemand leadingInlineGrouprequested by @ceberam in #5034. The group contains the heading text and formula items. Numbering, heading levels and the parent of following body content are preserved.The empty
heading.textis intentional in this rich content representation. JSON retains the content in the inline children. Consumers must read those children or use a serializer instead of treating the heading'stextfield as the complete title.Issue resolved by this Pull Request:
Resolves #5034
Checklist:
Validation:
All 312 Word tests pass with the pinned
docling-core 2.104.0and with the companion core fix. The 10 focused parser tests also pass with the minimum supported core,2.103.1, and fail on the original parser. They check the parsed tree, JSON round trip, equation order, hidden runs and numbering.make validatepasses. Reference files are unchanged.Merge dependency:
Ready for review. Please hold the merge until docling-core#933 is merged and released. That fix is needed for correct heading exports and chunk metadata when the heading also owns body content. Once a released version contains it, the minimum core dependency and lock file must be updated before this PR is ready to merge. No unreleased Git dependency or speculative version pin is added here.
The export and chunking regressions are tested in the core PR. PDF/model tests are outside this validation.