From c20d74cb5793d5821eadb2f96ac2e8e336e9a94a Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sun, 5 Jul 2026 21:35:22 +0530 Subject: Switch to md4c for markdown rendering --- cgit/filters/about.sh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'cgit/filters/about.sh') diff --git a/cgit/filters/about.sh b/cgit/filters/about.sh index e8554b0..9455ce7 100755 --- a/cgit/filters/about.sh +++ b/cgit/filters/about.sh @@ -1,5 +1,25 @@ #!/usr/bin/env sh # About content filter -/usr/lib/cgit/filters/about-formatting.sh "$@" | /usr/lib/cgit/filters/ediblemonad/html-transform.py +set -eu +# TODO: Add toc links for headers in markdown +md_to_html() { + echo '
' + md2html \ + --fpermissive-url-autolinks --fpermissive-www-autolinks \ + --flatex-math --ftasklists --ftables --funderline \ + --github - + echo '
' +} + +to_html() { + case "$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]')" in + *.markdown|*.mdown|*.md|*.mkd) md_to_html ;; + *.htm|*.html) exec cat ;; + *) /usr/lib/cgit/filters/about-formatting.sh "$@" ;; + esac +} + +(to_html "$@" | /usr/lib/cgit/filters/ediblemonad/html-transform.py) || \ + (echo "
Error rendering markdown
" && cat) -- cgit v1.3.1