Skip to main content

Module tree

Module tree 

Source
Expand description

docling’s item tree, for a backend that knows the exact shape upstream gives a document and wants the JSON export to reproduce it.

DoclingDocument::nodes is a flat, reading-order stream tuned for Markdown / DocLang / LaTeX; the JSON export rebuilds docling’s parent/child structure from it with generic rules (runs of list items become list groups, a heading is a flat sibling of the text that follows it). Upstream’s backends do not all agree on that structure: the HTML backend nests everything after a heading under the heading, splits a paragraph of mixed formatting into an inline group of one text item per formatting run, parents a rich table cell’s content to a group under the table, keeps site chrome on the furniture layer… and numbers every item in the order it creates them. A backend that ports those rules call-for-call (HTML’s html_tree.rs, DOCX’s docx_tree.rs) records the result here — an arena of items in creation order, each with its parent and children — and the JSON export (DoclingDocument::export_to_json) serializes this tree instead of deriving one from the nodes. Every other serializer keeps reading the flat nodes, so their output is unaffected.

Structs§

Formatting
docling-core’s Formatting: the inline styles an item carries in JSON.
ItemTree
docling’s item tree in creation order (see the module docs).
ListMeta
A list_item’s docling fields.
SourceBlock
A block of the source document (#903, #904): the original element an item was made from — or one that produced no item, with the reason — so a caller can tie converted items back to the source, tell two identical texts apart, and read a block’s text on its own terms, free of any serializer’s separators.
SourceElement
An element of the source that is not a block but carries an id or a class (#910): a container — the <div id="art_23"> an article’s paragraphs sit in — so an excerpt selected by a container’s identity resolves to a path and, through ItemTree::blocks_under, to the blocks inside it. A block’s own identity is on the block.
SourceInline
An inline element inside a SourceBlock (#911): where its text sits in the block’s, so a caller can select or leave out the text of one element — not a whole block — by what the source says about it.
SourceTextBuilder
Builds a SourceBlock’s normalized text while recording the inline elements’ ranges in it (#911) — for a backend walking its source: text nodes through push_text, a line break as whitespace, an inline element between open_inline and close_inline. Whitespace runs collapse to one space, the text is trimmed, and a range never starts with the space that separates it from what precedes.
TreeItem
One item of an ItemTree.
TreeNote
A note call inside a text item (TreeItem::notes).
TreeProv
docling’s ProvenanceItem for a tree item, written verbatim: the backend’s own geometry in the page’s units — a PPTX shape’s EMU box, whose pages entry is the slide size in EMU — rather than the 0–511 DocLang grid the flat Node::Located carries (which cannot round-trip those integers).
TreeTrack
docling’s TrackSource — where in a time-based track (a WebVTT cue) a text item came from. Written as the item’s source: [{"kind": "track", …}].

Enums§

BlockOmission
Why a SourceBlock produced no item.
TreeKind
What an item in the tree is. Mirrors the docling-core item classes the JSON texts / groups / tables / pictures / field_regions buckets hold.