Skip to content
Discussion options

You must be logged in to vote

Here's a Python sketch for post-processing doctags into markdown, with your header table (from <otsl>) transformed into either plain text or a YAML metadata section at the top of your markdown file.

from docling_core.types.doc.document import DoclingDocument, DocItemLabel, ContentLayer
import yaml

# Load doctags into DoclingDocument
doc = DoclingDocument.load_from_doctags(doctags_document)

# Find header tables (commonly in ContentLayer.FURNITURE or first table per page)
header_tables = []
for item, _ in doc.iterate_items(included_content_layers={ContentLayer.FURNITURE, ContentLayer.BODY}):
    if getattr(item, "label", None) == DocItemLabel.TABLE:
        # You may want to refine this …

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@az-ihsan
Comment options

@dosubot
Comment options

@az-ihsan
Comment options

@dosubot
Comment options

Answer selected by az-ihsan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant