Skip to content

Commit a24896c

Browse files
authored
fix: fix broken links and mermaid diagram on doc website (#452)
Replace markdownify with .Page.RenderString in the include-file shortcode to properly render fenced code blocks (including mermaid diagrams). Switch the getting_started page from {{% %}} to {{< >}} shortcode syntax to prevent double markdown processing that caused HTML double-escaping. Add regex rewrites to convert remaining relative repo links (examples/, roadmap.md, docs/configuration.md, etc.) to their corresponding GitHub URLs.
1 parent a0d4b1d commit a24896c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

site/content/docs/getting_started/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ description: >
66
How to get started with Agent Sandbox
77
---
88

9-
{{% include-file file="additional/README.md" %}}
9+
{{< include-file file="additional/README.md" >}}

site/layouts/shortcodes/include-file.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,10 @@
1313
{{- $content = replaceRE `\]\(\.\.\/\.\./(README|INSTALL)\.md(#[^)]+)?\)` "](/docs/getting_started/$2)" $content -}}
1414
{{- $content = replaceRE `src="site/assets/` `src="/assets/` $content -}}
1515

16-
{{- $content | markdownify -}}
16+
{{/* Rewrite remaining relative links to point to the GitHub repo */}}
17+
{{- $ghBase := "https://github.com/kubernetes-sigs/agent-sandbox/blob/main/" -}}
18+
{{- $ghTree := "https://github.com/kubernetes-sigs/agent-sandbox/tree/main/" -}}
19+
{{- $content = replaceRE `\]\(([a-zA-Z][a-zA-Z0-9_/.+-]*)/\)` (printf "](%s$1/)" $ghTree) $content -}}
20+
{{- $content = replaceRE `\]\(([a-zA-Z][a-zA-Z0-9_/.+-]*\.[a-zA-Z0-9]+)\)` (printf "](%s$1)" $ghBase) $content -}}
21+
22+
{{- $content | .Page.RenderString -}}

0 commit comments

Comments
 (0)