Skip to content

fix(markdown): cap section header depth at six heading levels - #872

Merged
ceberam merged 2 commits into
docling-project:mainfrom
RavSinghChandan:markdown-heading-level-cap
Oct 20, 2026
Merged

ceberam merged 2 commits into
docling-project:mainfrom
RavSinghChandan:markdown-heading-level-cap

Conversation

@RavSinghChandan

Copy link
Copy Markdown
Contributor

…adingsThe Markdown serializer writes a section header of level N with N + 1 #, so a header at level 6 or deeper became ####### or more. Markdown only has six heading levels, so those lines render as plain text starting with hashes ("######## Deep") instead of headings. The HTML serializer already caps these at <h6>.

The number of # is now capped at 6, so deep section headers stay level-6 headings. Levels 1-5 are unchanged. Added test_md_deep_section_headers_stay_headings.

@github-actions

Copy link
Copy Markdown
Contributor

✅ DCO Check Passed

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

@mergify

mergify Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 All 2 merge protections satisfied — ready to merge.

Show 2 satisfied protections

🟢 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)(?:\(.+\))?(!)?:

🟢 Require two reviewer for test updates

When test data is updated, we require two reviewers

  • #approved-reviews-by >= 2

@codecov

codecov Bot commented Oct 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ceberam ceberam added bug Something isn't working serialization Output serializers: Markdown, HTML, LaTeX, JSON, plain-text, outline labels Oct 16, 2026
@ceberam ceberam changed the title fix(markdown): keep section headers deeper than level 5 as level-6 he… fix(markdown): cap section header depth at six heading levels Oct 16, 2026

@ceberam ceberam left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution, @RavSinghChandan. This is a small, focused fix and it does what it claims. I only have minor, non-blocking suggestions (mainly the docstring) and I don't see anything that blocks merging.

Comment thread tests/test_serialization.py Resolved

@ceberam ceberam left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @RavSinghChandan for the small changes to the documentation. All good 🚀

@RavSinghChandan

Copy link
Copy Markdown
Contributor Author

Thanks for the review!

@ceberam
ceberam merged commit 4422110 into docling-project:main Oct 20, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working serialization Output serializers: Markdown, HTML, LaTeX, JSON, plain-text, outline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants