... | ... |
@@ -92,6 +92,8 @@ |
92 | 92 |
% } elsif ($mime_type =~ m#^text/#) { |
93 | 93 |
% if ($file =~ /\.md$/) { |
94 | 94 |
% my $readme = join "\n", @$lines; |
95 |
+ % $readme =~ s#^(\[.*\]:)(?!\s*https?://)\s*(\S*)#$1 /$user/$project/raw/$rev/$2#mg; |
|
96 |
+ % $readme =~ s#^(!\[.*\]\()(?!https?://)(\S*)#$1/$user/$project/raw/$rev/$2#mg; |
|
95 | 97 |
% my $readme_e = Text::Markdown::Hoedown::markdown($readme, extensions => HOEDOWN_EXT_FENCED_CODE); |
96 | 98 |
<div class="markdown border-gray"> |
97 | 99 |
<%== $readme_e %> |
... | ... |
@@ -13,6 +13,8 @@ |
13 | 13 |
if ($lines) { |
14 | 14 |
$type = 'plain'; |
15 | 15 |
my $readme = join "\n", @$lines; |
16 |
+ $readme =~ s#^(\[.*\]:)(?!\s*https?://)\s*(\S*)#$1 /$user/$project/raw/$rev/$2#mg; |
|
17 |
+ $readme =~ s#^(!\[.*\]\()(?!https?://)(\S*)#$1/$user/$project/raw/$rev/$2#mg; |
|
16 | 18 |
$readme_e = Mojo::ByteStream->new($readme)->xml_escape->to_string; |
17 | 19 |
$readme_e =~ s#(^|\s|[^\x00-\x7F])(http(?:s)?://.+?)($|\s|[^\x00-\x7F])#$1<a href="$2">$2</a>$3#msg; |
18 | 20 |
} |