aboutsummaryrefslogtreecommitdiffstats
path: root/filters/about-formatting.sh
diff options
context:
space:
mode:
authorJason A. Dönerfield <no-replay@sl0p.foo>2026-07-18 21:07:20 +0200
committerJason A. Dönerfield <no-replay@sl0p.foo>2026-07-18 21:31:00 +0200
commite3364e2c4424b373f80ac04d1ab2e3f3d82328e1 (patch)
tree78bf7b8fbf87781e25fd287e6307b664b468f630 /filters/about-formatting.sh
parentmd2html: rewrite relative README links to the tree/ blob URL (diff)
downloadcgit-e3364e2c4424b373f80ac04d1ab2e3f3d82328e1.tar.gz
cgit-e3364e2c4424b373f80ac04d1ab2e3f3d82328e1.tar.xz
cgit-e3364e2c4424b373f80ac04d1ab2e3f3d82328e1.zip
md2html: render linked .md via the about view, fix relative base
Links to markdown files now point at /<repo>/about/<path> (rendered through the about-filter) instead of /<repo>/tree/<path> (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.
Diffstat (limited to 'filters/about-formatting.sh')
-rwxr-xr-xfilters/about-formatting.sh2
1 files changed, 1 insertions, 1 deletions
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; ;;