Skip to content

fix: html serialization of lists with mixed markers - #701

Open
julianfesel wants to merge 5 commits into
docling-project:mainfrom
julianfesel:fix/#699-html-serialization-list-markers
Open

julianfesel wants to merge 5 commits into
docling-project:mainfrom
julianfesel:fix/#699-html-serialization-list-markers

Conversation

@julianfesel

Copy link
Copy Markdown

This PR implements option 1 of issue #699

HTML list items with an empty marker now render with list-style-type: none; when original markers are being shown, so the browser no longer invents numbering that is not present in the DoclingDocument.

Changes

  • Updated HTMLTextSerializer to suppress default list markers for unmarked list items while preserving explicit markers.
  • Added a regression test for a mixed enumerated/non-enumerated list group.
  • Refreshed the affected HTML and chunker goldens to match the new serializer output.

@github-actions

Copy link
Copy Markdown
Contributor

✅ DCO Check Passed

Thanks @julianfesel, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Merge Protections

🔴 1 of 2 protections blocking · waiting on 👀 reviews

Protection Waiting on
🔴 Require two reviewer for test updates 👀 reviews
🟢 Enforce conventional commit —

🔴 Require two reviewer for test updates

Waiting for

  • #approved-reviews-by >= 2
This rule is failing.

When test data is updated, we require two reviewers

  • #approved-reviews-by >= 2

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

@dolfim-ibm

Copy link
Copy Markdown
Member

@julianfesel are all the changes produced on the test files what you would expect?

@julianfesel

Copy link
Copy Markdown
Author

@julianfesel are all the changes produced on the test files what you would expect?

@dolfim-ibm

For show_original_list_item_marker=True, yes. However, based on your comment, I realized that I had misunderstood the role of marker: "" in Docling. I did not realize that it is not nullable.

In the new commits, I narrowed the application of strict markers to enumerated lists that contain at least one detected marker. As a result, there is now only one change in the test cases, which I believe is correct.

In my opinion, automatic enumeration does not make sense when at least one numeric marker is present. At the very least, this would require a more detailed validation. In such cases, one cannot assume that the default enumeration is correct. Furthermore, especially in OCR scenarios, the marker may actually be part of the text itself.

@codecov

codecov Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@julianfesel
julianfesel force-pushed the fix/#699-html-serialization-list-markers branch from a8761e0 to d89dea0 Compare October 28, 2026 15:24
@mergify

mergify Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🔴 1 of 2 protections blocking · waiting on 👀 reviews

Protection Waiting on
🔴 Require two reviewer for test updates 👀 reviews
🟢 Enforce conventional commit —

🔴 Require two reviewer for test updates

Waiting for

  • #approved-reviews-by >= 2
This rule is failing.

When test data is updated, we require two reviewers

  • #approved-reviews-by >= 2

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

@mergify

mergify Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🔴 1 of 2 protections blocking · waiting on 👀 reviews

Protection Waiting on
🔴 Require two reviewer for test updates 👀 reviews
🟢 Enforce conventional commit —

🔴 Require two reviewer for test updates

Waiting for

  • #approved-reviews-by >= 2
This rule is failing.

When test data is updated, we require two reviewers

  • #approved-reviews-by >= 2

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

@github-actions github-actions Bot added ai:ci-safe AI triage found no CI-safety concern (advisory) bug Something isn't working document-model DoclingDocument core model, metadata, hierarchy, validation serialization Output serializers: Markdown, HTML, LaTeX, JSON, plain-text, outline labels Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

AI triage (advisory)

Checked commit 492e4fb5eb. The analysis read the diff only. It did not run code from this pull request.

The HTML serializer now writes list-style-type: none; for list items that have no marker, but only inside an ordered list where at least one item has a marker. This stops the browser from inventing numbers for those items. The PR adds ListGroup.any_item_has_marker(), a strict_list_markers argument, new tests, and updated HTML reference files.

Topic labels added: bug, serialization, document-model.

CI safety: no concern found. A maintainer must still approve CI.

2 related pull request(s) in the same code
PR State Signal Assessment
#923 open changes the same code related: It changes the same file, html.py, but it fixes a cycle in key-value graph rendering. It does not touch list markers.
#700 closed also references issue #699 related: It is an earlier closed attempt by the same author for the same issue. It is not merged. It applied list-style-type: none; to every unmarked item, and this PR limits that to ordered lists with mixed markers.

Reference data changes

Change Files
text 6
  • text tests/data/doc/concatenated.html: +2 / -2 lines
  • text tests/data/doc/constructed_doc.embedded.html.gt: +2 / -2 lines
  • text tests/data/doc/constructed_doc.placeholder.html.gt: +2 / -2 lines
  • text tests/data/doc/constructed_doc.referenced.html.gt: +2 / -2 lines
  • text tests/data/doc/constructed_document.yaml.html: +2 / -2 lines
  • text tests/data/doc/constructed_orig_true.gt.html: +2 / -2 lines

Assessment: expected. Six HTML reference files each change by 2 lines, which fits the new list-style-type output for mixed-marker ordered lists in the constructed document. The diff omits the reference content, so this rests on the size and pattern of the change.

The ai:* labels are advisory. They do not approve CI and they do not add tests:full. A new push runs this check again.

@julianfesel

julianfesel commented Nov 4, 2026 •

Copy link
Copy Markdown
Author

@dolfim-ibm @ceberam is there still something open I must do to finish this?

@mergify

mergify Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🔴 1 of 2 protections blocking · waiting on 👀 reviews

Protection Waiting on
🔴 Require two reviewer for test updates 👀 reviews
🟢 Enforce conventional commit —

🔴 Require two reviewer for test updates

Waiting for

  • #approved-reviews-by >= 2
This rule is failing.

When test data is updated, we require two reviewers

  • #approved-reviews-by >= 2

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai:ci-safe AI triage found no CI-safety concern (advisory) bug Something isn't working document-model DoclingDocument core model, metadata, hierarchy, validation serialization Output serializers: Markdown, HTML, LaTeX, JSON, plain-text, outline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTML serializer introduces browser-generated markers for list items without a detected marker

2 participants