Skip to content

Commit 328778e

Browse files
feat: improve markdown export of DoclingDocument (#50)
* feat: improve export of doclingdocument Signed-off-by: Peter Staar <[email protected]> * added indented text Signed-off-by: Peter Staar <[email protected]> * updated the labels in to_indented_text Signed-off-by: Peter Staar <[email protected]> * updated the export of text Signed-off-by: Peter Staar <[email protected]> * updated the export of indented text Signed-off-by: Peter Staar <[email protected]> * fixed the mypy and flake8 Signed-off-by: Peter Staar <[email protected]> * updated the export to markdown leveraging the hierarchy Signed-off-by: Peter Staar <[email protected]> * fixed the mypy and flake Signed-off-by: Peter Staar <[email protected]> * updated the export_to_markdown_v2 Signed-off-by: Peter Staar <[email protected]> * updated the export_to_markdown_v2 (2) Signed-off-by: Peter Staar <[email protected]> * adding new tests Signed-off-by: Peter Staar <[email protected]> * fixed the test Signed-off-by: Peter Staar <[email protected]> * fixed the precommits Signed-off-by: Peter Staar <[email protected]> * fixed the title and section-headers in document Signed-off-by: Peter Staar <[email protected]> * indented all Signed-off-by: Peter Staar <[email protected]> * Cleanup markdown v2 export Signed-off-by: Christoph Auer <[email protected]> * Remove unnecessary methods Signed-off-by: Christoph Auer <[email protected]> * Mark methods private Signed-off-by: Christoph Auer <[email protected]> * fixed the extra parameters for export_to_markdown Signed-off-by: Peter Staar <[email protected]> * Add ImageRefMode arg Signed-off-by: Christoph Auer <[email protected]> * fixed the strict_text argument Signed-off-by: Peter Staar <[email protected]> * fixed the indent of the lists Signed-off-by: Peter Staar <[email protected]> * make table output explicit Signed-off-by: Peter Staar <[email protected]> * Improve list rendering code. Signed-off-by: Christoph Auer <[email protected]> * Improve empty lines between sections and elements Signed-off-by: Christoph Auer <[email protected]> * Add text/markdown mime Signed-off-by: Christoph Auer <[email protected]> * Fix indentation spaces on markdown lists Signed-off-by: Christoph Auer <[email protected]> * make list indent a parameter with default 4 Signed-off-by: Peter Staar <[email protected]> * make list indent a parameter with default 4 (reindented) Signed-off-by: Peter Staar <[email protected]> * Fix separation of multiple adjacent lists on same level Signed-off-by: Christoph Auer <[email protected]> * Correct comments Signed-off-by: Christoph Auer <[email protected]> --------- Signed-off-by: Peter Staar <[email protected]> Signed-off-by: Christoph Auer <[email protected]> Co-authored-by: Christoph Auer <[email protected]>
1 parent d09fe7e commit 328778e

File tree

4 files changed

+254
-113
lines changed

4 files changed

+254
-113
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
per-file-ignores = __init__.py:F401
33
max-line-length = 88
44
exclude = test/*
5-
max-complexity = 18
5+
max-complexity = 25
66
docstring-convention = google
77
ignore = W503,E203
88
classmethod-decorators = classmethod,validator

docling_core/types/doc/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
"""Package for models defined by the Document type."""
77

8-
from .base import BoundingBox, CoordOrigin, Size
8+
from .base import BoundingBox, CoordOrigin, ImageRefMode, Size
99
from .document import (
1010
DocItem,
1111
DoclingDocument,

docling_core/types/doc/base.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
from pydantic import BaseModel
88

99

10+
class ImageRefMode(str, Enum):
11+
"""ImageRefMode."""
12+
13+
PLACEHOLDER = "placeholder"
14+
EMBEDDED = "embedded"
15+
16+
1017
class CoordOrigin(str, Enum):
1118
"""CoordOrigin."""
1219

0 commit comments

Comments
 (0)