else {
eval q{use Text::Markdown};
if (! $@) {
- $markdown_sub=\&Text::Markdown::Markdown;
+ if (Text::Markdown->can('markdown')) {
+ $markdown_sub=\&Text::Markdown::markdown;
+ }
+ else {
+ $markdown_sub=\&Text::Markdown::Markdown;
+ }
}
else {
do "/usr/bin/markdown" ||
require Encode;
}
- my $oneline = $content !~ /\n/;
-
# Workaround for perl bug (#376329)
$content=Encode::encode_utf8($content);
eval {$content=&$markdown_sub($content)};
}
$content=Encode::decode_utf8($content);
- if ($oneline) {
- # hack to get rid of enclosing junk added by markdown
- $content=~s!^<p>!!;
- $content=~s!</p>$!!;
- chomp $content;
- }
-
return $content;
} # }}}