From: Andrew Lorimer Date: Sat, 9 Sep 2023 02:44:23 +0000 (+1000) Subject: conditional markdown preprocessing X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain conditional markdown preprocessing --- diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 6ddde75dee..e60bc31ad8 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -16,6 +16,7 @@ use filetest 'access'; use HTML::Entities; use Pandoc; +use Text::Markdown qw(markdown); use CGI qw(:standard :escapeHTML -nosticky); use CGI::Util qw(unescape); #use CGI::Carp qw(fatalsToBrowser set_message); # debugging only @@ -6922,9 +6923,13 @@ sub git_summary { # Process markdown if necessary if ($readme_file =~ /\.md$/i && check_pandoc()) { - $filecontents = pandoc->parse('markdown' => $filecontents)->to_html; + #$filecontents = pandoc->parse('markdown' => $filecontents)->to_html; + $filecontents = markdown($filecontents);; + print($filecontents); + } + else { + print($cgi->escapeHTML($filecontents)); } - print($filecontents); close $fd or die_error(500, "Error processing readme file $hash");