From e3364e2c4424b373f80ac04d1ab2e3f3d82328e1 Mon Sep 17 00:00:00 2001 From: "Jason A. Dönerfield" Date: Sat, 18 Jul 2026 21:07:20 +0200 Subject: md2html: render linked .md via the about view, fix relative base Links to markdown files now point at //about/ (rendered through the about-filter) instead of //tree/ (raw blob), so clicking a README link to another .md shows rendered markdown. Also resolve relative links against the rendered file's own directory: about-formatting.sh now forwards the filename cgit passes ($1) to md2html as argv[1], and md2html uses dirname(argv[1]) as the base. This makes links *inside* a rendered subpage (docs/foo.md -> ./bar.md, ../README.md, images) resolve correctly. Non-markdown files and directories still go to tree/; images to plain/; about/ links carry no ?h= since the about view renders against the configured readme ref. --- filters/about-formatting.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'filters/about-formatting.sh') diff --git a/filters/about-formatting.sh b/filters/about-formatting.sh index 85daf9c..c6c4f9c 100755 --- a/filters/about-formatting.sh +++ b/filters/about-formatting.sh @@ -19,7 +19,7 @@ cd "$(dirname $0)/html-converters/" case "$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]')" in - *.markdown|*.mdown|*.md|*.mkd) exec ./md2html; ;; + *.markdown|*.mdown|*.md|*.mkd) exec ./md2html "$1"; ;; *.rst) exec ./rst2html; ;; *.[1-9]) exec ./man2html; ;; *.htm|*.html) exec cat; ;; -- cgit v1.3.1-sl0p