Skip to content

Commit

Permalink
fix: Quote referenced URIs in markdown and html (#122)
Browse files Browse the repository at this point in the history
Quote referenced URIs in markdown and html

Signed-off-by: Christoph Auer <[email protected]>
  • Loading branch information
cau-git authored Jan 7, 2025
1 parent f464be5 commit 127dd2f
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 127dd2f

Please sign in to comment.