Repository navigation
Conversation
|
✅ DCO Check Passed Thanks @chrikrah, 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 makes the Markdown backend apply the formatting of inline HTML tags such as CI safety: no concern found. A maintainer must still approve CI. 2 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 599280eeb2. It read the code and did not run it.
I found no defect that decides the merge. The change in docling/backend/md_backend.py is limited to marko.inline.InlineHTML children of one element. It applies only the tags in _FORMAT_TAG_MAP that carry a formatting, and an unclosed tag ends with its block. I checked this against the existing emphasis, heading, list-item and line-break paths and found no regression.
A maintainer makes the merge decision. This review never approves the pull request.
Inline HTML in a Markdown paragraph, heading or list item was dropped together with its formatting, so 'a <b>bold</b> c' gave plain text. Track the tags that the HTML backend maps to a formatting across the sibling nodes they wrap, and end them at their closing tag or with their block. Signed-off-by: Christopher Krah <48338417+chrikrah@users.noreply.github.com>
599280e to
0103644
Compare
There was a problem hiding this comment.
AI first review (advisory): no blocker found
This review covers the full diff at 0103644319. It read the code and did not run it.
I found no defect that decides the merge. I read the new children loop in _iterate_elements in docling/backend/md_backend.py against the existing emphasis, link, heading, list-item and line-break paths. I also read _FORMAT_TAG_MAP in docling/backend/html_backend.py. Formatting stays scoped to one element's children, and an unclosed tag ends with its block. The new import adds no dependency, because md_backend.py already imports html_backend through MarkdownHTMLDocumentBackend. The new tests cover the fixed defect and the unclosed-tag case. I could not see the test results for the 11 Markdown test files, because the PR body is cut off at "5 failed", so the maintainer must confirm that CI is green on the head commit.
A maintainer makes the merge decision. This review never approves the pull request.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
@chrikrah Quicl question: if you adress the |
PeterStaar-IBM
left a comment
There was a problem hiding this comment.
can we do sub and sup in addition to bold and italic?
Signed-off-by: Christopher Krah <48338417+chrikrah@users.noreply.github.com>
chrikrah
left a comment
There was a problem hiding this comment.
@PeterStaar-IBM it does both. <sub> and <sup> go through the same _FORMAT_TAG_MAP lookup as <b>, so H2O already comes out with script: sub, and test_inline_html_formatting_tags asserts both scripts (tests/test_backend_markdown.py:1636). My opening line named only <sup>, which didn't help, and the body's Markdown export still prints H 2 O because docling-core's Markdown serializer has no sub/sup syntax, so the script field on the item is where it shows.
# git archive 0103644 (base 0fa0918), Python 3.12, marko installed, docling.__file__ from the export
$ python probe.py # convert_string("H<sub>2</sub>O and E = mc<sup>2</sup>", format=InputFormat.MD), (text, script)
[('H', None), ('2', 'sub'), ('O and E = mc', None), ('2', 'super')]
$ python -m pytest -q tests/test_backend_markdown.py -k inline_html
2 passed, 62 deselected
# md_backend.py from 0fa0918, tests kept
[('H', None), ('2', None), ('O and E = mc', None), ('2', None)]
2 failed, 62 deselected
# not run: the full suite at this head
I merged main in 253042b to clear the conflict with #4991 in tests/test_backend_markdown.py, keeping both sets of tests: 80 passed there against 78 on main. Does the sub/sup answer clear your change request?
_iterate_elements(docling/backend/md_backend.py:1052on07154cd) dropsmarko.inline.InlineHTML, and with it the formatting of<b>,<em>or<sup>in a paragraph, heading or list item. CommonMark (0.31, section 6.6) passes them through as raw HTML, so a reader sees that formatting, and the HTML backend already keeps it.Before, on
07154cd:After, on this branch:
Marko gives the tags as siblings of the text they wrap, so the children loop now carries the formatting from the opening tag to the closing one, using the HTML backend's
_FORMAT_TAG_MAP. Other inline HTML is still dropped, and table cells (_iterate_cell_inline) do not change. No issue tracks this.Checklist:
Review evidence:
No source in
tests/data/mdholds such a tag, so no ground truth changes.@PeterStaar-IBM, an unclosed
<b>now runs to the end of its paragraph, where a browser ends it too. I'd keep that, since it matches the rendered Markdown. Does that work for you?Rebased onto
0fa0918.