You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.
sub gfm{
my $content = shift // '';
my %extractions;
# Extract pre blocks
my $extract = sub {
my $content = shift // '';
my $md5 = md5_hex($content);
$extractions{$md5} = $content;
return "{gfm-extraction-$md5}";
};
$content =~ s{(<pre>.*?</pre>)}{$extract->($1)}ges;
# prevent foo_bar_baz from ending up with an italic word in the middle
my $underscores = sub {
my $content = shift // '';
$content =~ s/_/\\_/g
if ( $content =~ tr/_// ) > 1;
return $content;
};
$content =~ s/(^(?! {4}|\t)\w+_\w+_\w[\w_]*)/$underscores->($1)/gem;
# in very clear cases, let newlines become <br /> tags
my $brs = sub {
my $content = shift // '';
return $content if $content =~ /\n\n/;
$content =~ s/^\s+//;
$content =~ s/\s+$//;
return "$content \n";
};
$content =~ s/^([\w<][^\n]*\n+)/$brs->($1)/gexm;
# Insert pre block extractions
$content =~ s/\{gfm-extraction-([0-9a-f]{32})\}/$extractions{$1}/ge;
return $content;
}
The text was updated successfully, but these errors were encountered:
Hiya
I've written some code to support github flavoured markdown, if you want to add it to Text::Markdown:
http://github.github.com/github-flavored-markdown/
The text was updated successfully, but these errors were encountered: