Skip to content

Commit dd6ebc3

Browse files
authored
fix: expose escape_html param to DoclingDocument md serialization (#388)
Signed-off-by: Cesar Berrospi Ramis <[email protected]>
1 parent 12292d7 commit dd6ebc3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docling_core/types/doc/document.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4386,6 +4386,7 @@ def save_as_markdown(
43864386
to_element: int = sys.maxsize,
43874387
labels: Optional[set[DocItemLabel]] = None,
43884388
strict_text: bool = False,
4389+
escape_html: bool = True,
43894390
escaping_underscores: bool = True,
43904391
image_placeholder: str = "<!-- image -->",
43914392
image_mode: ImageRefMode = ImageRefMode.PLACEHOLDER,
@@ -4414,6 +4415,7 @@ def save_as_markdown(
44144415
to_element=to_element,
44154416
labels=labels,
44164417
strict_text=strict_text,
4418+
escape_html=escape_html,
44174419
escape_underscores=escaping_underscores,
44184420
image_placeholder=image_placeholder,
44194421
image_mode=image_mode,
@@ -4435,6 +4437,7 @@ def export_to_markdown( # noqa: C901
44354437
to_element: int = sys.maxsize,
44364438
labels: Optional[set[DocItemLabel]] = None,
44374439
strict_text: bool = False,
4440+
escape_html: bool = True,
44384441
escape_underscores: bool = True,
44394442
image_placeholder: str = "<!-- image -->",
44404443
enable_chart_tables: bool = True,
@@ -4465,6 +4468,8 @@ def export_to_markdown( # noqa: C901
44654468
:type labels: Optional[set[DocItemLabel]] = None
44664469
:param strict_text: Deprecated.
44674470
:type strict_text: bool = False
4471+
:param escape_html: bool: Whether to escape HTML reserved characters in the
4472+
text content of the document. (Default value = True).
44684473
:param escape_underscores: bool: Whether to escape underscores in the
44694474
text content of the document. (Default value = True).
44704475
:type escape_underscores: bool = True
@@ -4511,6 +4516,7 @@ def export_to_markdown( # noqa: C901
45114516
pages={page_no} if page_no is not None else None,
45124517
start_idx=from_element,
45134518
stop_idx=to_element,
4519+
escape_html=escape_html,
45144520
escape_underscores=escape_underscores,
45154521
image_placeholder=image_placeholder,
45164522
enable_chart_tables=enable_chart_tables,

0 commit comments

Comments
 (0)