From 50cbea44837abc1a209555b75610b5b7baed46c2 Mon Sep 17 00:00:00 2001 From: Leonid Fedotov <3584432+iLeonidze@users.noreply.github.com> Date: Fri, 6 Jun 2025 16:59:05 +0300 Subject: [PATCH] Update md_backend.py Signed-off-by: Leonid Fedotov <3584432+iLeonidze@users.noreply.github.com> --- docling/backend/md_backend.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/docling/backend/md_backend.py b/docling/backend/md_backend.py index fbe17ee0..d39890a9 100644 --- a/docling/backend/md_backend.py +++ b/docling/backend/md_backend.py @@ -247,7 +247,24 @@ class MarkdownDocumentBackend(DeclarativeDocumentBackend): self._process_inline_text(parent_item, doc) _log.debug(" - List item") - snippet_text = str(first_child.children[0].children) # type: ignore + snippet_text = ( + (lambda extractor: + (lambda node: extractor(extractor, node)) + ) + ( + lambda self, node: ( + node.children + if hasattr(node, 'children') and isinstance(node.children, str) + else ''.join( + self(self, child) + for child in node.children + ) + if hasattr(node, 'children') + else str(node) + ) + ) + )(first_child) # type: ignore + is_numbered = False if ( parent_item is not None