Skip to content

Commit 5a45e9f

Browse files
authored
fix: md conversion
1 parent 90347ff commit 5a45e9f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

scrapegraphai/utils/convert_to_md.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ def convert_to_md(html: str, url: str = None) -> str:
2020
2121
Note: All the styles and links are ignored during the conversion. """
2222

23-
if url:
24-
parsed_url = urlparse(url)
25-
domain = f"{parsed_url.scheme}://{parsed_url.netloc}"
2623
h = html2text.HTML2Text()
2724
h.ignore_links = False
28-
h.baseurl = domain
2925
h.body_width = 0
26+
if url:
27+
parsed_url = urlparse(url)
28+
domain = f"{parsed_url.scheme}://{parsed_url.netloc}"
29+
h.baseurl = domain
30+
3031
return h.handle(html)

0 commit comments

Comments
 (0)