Skip to content

Chandra and Nemotron section headings export one level too deep #4902

Closed

Description

@PierreMesure

Bug

Chandra HTML headings and Nemotron Parse 2.0 Markdown section headings export one level too deep. Their parsers store the source H1–H6 number directly in SectionHeaderItem.level, but Docling reserves the title level: section level 1 exports as ##.

Steps to reproduce

  • Parse Chandra <div data-bbox="100 100 900 200" data-label="Section-Header"><h3>Method</h3></div> with parse_chandra_html.
  • Or parse <x_0.2><y_0.2>### Method<x_0.8><y_0.4><class_Section-header> with parse_nemotron_parse_v2.
  • Call document.export_to_markdown().

Actual: #### Method. Expected: ### Method, with the original text and coordinates retained.

The HTML correction belongs in the shared Chandra HTML mapper, including callers that reuse _add_html_fragment. Nemotron needs the same conversion for its native Markdown envelope. DOTS already converts its native heading depth correctly. The LightOnOCR work in #4789 found this mismatch; its local compensating pass should be removed when the shared mapper is corrected.

Docling version

Current main d01c9c0991920924cf17f6b8366079ac035ffc38 (2.140.0); reproduced locally on Python 3.12.

Activity

  1. added a commit that references this issue on Oct 22, 2026
    fec45d3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions