fix: md conversion

This commit is contained in:
Marco Perini 2024-07-23 18:09:15 +02:00 committed by GitHub
parent 90347ff870
commit 5a45e9f2d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -20,11 +20,12 @@ def convert_to_md(html: str, url: str = None) -> str:
Note: All the styles and links are ignored during the conversion. """
h = html2text.HTML2Text()
h.ignore_links = False
h.body_width = 0
if url:
parsed_url = urlparse(url)
domain = f"{parsed_url.scheme}://{parsed_url.netloc}"
h = html2text.HTML2Text()
h.ignore_links = False
h.baseurl = domain
h.body_width = 0
h.baseurl = domain
return h.handle(html)