Skip to content

Commit 127dd2f

Browse files
authored
fix: Quote referenced URIs in markdown and html (#122)
Quote referenced URIs in markdown and html Signed-off-by: Christoph Auer <[email protected]>
1 parent f464be5 commit 127dd2f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docling_core/types/doc/document.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from io import BytesIO
1515
from pathlib import Path
1616
from typing import Any, Dict, Final, List, Literal, Optional, Tuple, Union
17-
from urllib.parse import unquote
17+
from urllib.parse import quote, unquote
1818

1919
import pandas as pd
2020
import yaml
@@ -830,7 +830,7 @@ def export_to_markdown(
830830
):
831831
return default_response
832832

833-
text = f"\n![Image]({str(self.image.uri)})\n"
833+
text = f"\n![Image]({quote(str(self.image.uri))})\n"
834834
return text
835835

836836
else:
@@ -884,7 +884,7 @@ def export_to_html(
884884
):
885885
return default_response
886886

887-
img_text = f'<img src="{str(self.image.uri)}">'
887+
img_text = f'<img src="{quote(str(self.image.uri))}">'
888888
return f"<figure>{caption_text}{img_text}</figure>"
889889

890890
else:

0 commit comments

Comments
 (0)