fix(datasheet): broken images

This commit is contained in:
Uri Shaked
2024-04-11 15:14:31 +03:00
parent 9c7ebcb731
commit d9a6d6206d
2 changed files with 7 additions and 0 deletions
+4
View File
@@ -32,6 +32,10 @@ class ImagePathRewriterRenderer(MarkdownRenderer):
url = token["attrs"]["url"]
if "://" not in url and not url.startswith("/"):
token["attrs"]["url"] = os.path.join(self.prefix, url)
elif ".." in url:
token["attrs"]["url"] = ""
elif url.startswith("/"):
token["attrs"]["url"] = os.path.join(self.prefix, "../" + url[1:])
return super().image(token, state)