Skip to content

Commit

Permalink
Quote referenced URIs in markdown and html
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Auer <[email protected]>
  • Loading branch information
cau-git committed Jan 7, 2025
1 parent f464be5 commit 3b66995
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docling_core/types/doc/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from io import BytesIO
from pathlib import Path
from typing import Any, Dict, Final, List, Literal, Optional, Tuple, Union
from urllib.parse import unquote
from urllib.parse import quote, unquote

import pandas as pd
import yaml
Expand Down Expand Up @@ -830,7 +830,7 @@ def export_to_markdown(
):
return default_response

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

else:
Expand Down Expand Up @@ -884,7 +884,7 @@ def export_to_html(
):
return default_response

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

else:
Expand Down

0 comments on commit 3b66995

Please sign in to comment.