From 39c8cd2ae5eadec313661227055fe6d07246ca4e Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Wed, 15 Jul 2026 11:12:30 -1000 Subject: Render README markdown in the browser cgit had no markdown support of its own, so a readme was rendered through an external python filter or not at all. Escaping the source and formatting it in cgit.js keeps the work in the browser like the blob highlighter, and the page stays readable as plain text without scripting. --- cgitrc.5.txt | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'cgitrc.5.txt') diff --git a/cgitrc.5.txt b/cgitrc.5.txt index fd420f1..b5315cc 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -31,8 +31,9 @@ about-filter:: about pages (both top-level and for each repository). The command will get the content of the about-file on its STDIN, the name of the file as the first argument, and the STDOUT from the command will be - included verbatim on the about page. Default value: none. See - also: "FILTER API". + included verbatim on the about page. Default value: none. When no + about-filter is set, a markdown readme is instead rendered by the + bundled cgit.js (see enable-markdown). See also: "FILTER API". agefile:: Specifies a path, relative to each repository path, which can be used @@ -229,6 +230,14 @@ enable-tree-group-dirs:: in git's own order, with directories and files intermixed by name. Default value: "0". +enable-markdown:: + Flag which, when set to "1", renders a markdown readme on the about + page. cgit escapes the source and a small renderer bundled in cgit.js + formats it in the browser, so the page stays readable as plain text + when scripting is off. It applies only when no about-filter handles the + file, and only to names ending in .md, .markdown, .mkd or .mdown. + Default value: "1". + favicon:: Url used as link to a shortcut icon for cgit. It is suggested to use the value "/favicon.ico" since certain browsers will ignore other @@ -918,8 +927,8 @@ mimetype.svg=image/svg+xml # Source code is highlighted in the browser by the bundled cgit.js, so no # source-filter is needed here. Set one only to override that. -# Format markdown, restructuredtext, manpages, text files, and html files -# through the right converters +# Markdown about pages render client-side by default (see enable-markdown), +# so a filter is only needed for other formats such as manpages. about-filter=/var/www/cgit/filters/about-formatting.sh ## -- cgit v2.8.0