mirror of
https://github.com/TinyTapeout/tt-support-tools.git
synced 2026-11-03 04:36:09 +01:00
fix(datasheet): broken images
This commit is contained in:
@@ -76,6 +76,9 @@ class Docs:
|
|||||||
|
|
||||||
for project in self.projects:
|
for project in self.projects:
|
||||||
yaml_data = project.get_project_docs_dict()
|
yaml_data = project.get_project_docs_dict()
|
||||||
|
yaml_data["user_docs"] = rewrite_image_paths(
|
||||||
|
yaml_data["user_docs"], f"projects/{project.get_macro_name()}/docs"
|
||||||
|
)
|
||||||
yaml_data["mux_address"] = project.mux_address
|
yaml_data["mux_address"] = project.mux_address
|
||||||
|
|
||||||
logging.info(f"building datasheet for {project}")
|
logging.info(f"building datasheet for {project}")
|
||||||
|
|||||||
@@ -32,6 +32,10 @@ class ImagePathRewriterRenderer(MarkdownRenderer):
|
|||||||
url = token["attrs"]["url"]
|
url = token["attrs"]["url"]
|
||||||
if "://" not in url and not url.startswith("/"):
|
if "://" not in url and not url.startswith("/"):
|
||||||
token["attrs"]["url"] = os.path.join(self.prefix, url)
|
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)
|
return super().image(token, state)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user