From d147c2565f635e851b73cd6b97cc78617372b57f Mon Sep 17 00:00:00 2001 From: Michele Dolfi <97102151+dolfim-ibm@users.noreply.github.com> Date: Tue, 17 Dec 2024 10:05:15 +0100 Subject: [PATCH] fix: skip labels not included in the allow-list (#113) Signed-off-by: Michele Dolfi --- docling_core/types/doc/document.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docling_core/types/doc/document.py b/docling_core/types/doc/document.py index 496c937..4f1941e 100644 --- a/docling_core/types/doc/document.py +++ b/docling_core/types/doc/document.py @@ -2038,6 +2038,9 @@ def export_to_markdown( # noqa: C901 if ix < from_element or to_element <= ix: continue # skip as many items as you want + if (isinstance(item, DocItem)) and (item.label not in labels): + continue # skip any label that is not whitelisted + # Handle newlines between different types of content if ( len(mdtexts) > 0