From c8b1cd907f55e5b67cf2ac114295d77871fb58f4 Mon Sep 17 00:00:00 2001 From: Andrew Lorimer Date: Sat, 9 Sep 2023 12:44:23 +1000 Subject: [PATCH] conditional markdown preprocessing --- gitweb/gitweb.perl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 warnings; 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"); -- 2.43.2