+ if (exists $config{multimarkdown} && $config{multimarkdown}) {
+ eval q{use Text::MultiMarkdown};
+ if ($@) {
+ debug(gettext("multimarkdown is enabled, but Text::MultiMarkdown is not installed"));
+ }
+ else {
+ $markdown_sub=sub {
+ Text::MultiMarkdown::markdown(shift, {use_metadata => 0});
+ }
+ }
+ }
+ if (! defined $markdown_sub &&
+ (! exists $config{nodiscount} || ! $config{nodiscount})) {
+ eval q{use Text::Markdown::Discount};
+ if (! $@) {
+ $markdown_sub=sub {
+ my $t=shift;
+ # Workaround for discount binding bug
+ # https://rt.cpan.org/Ticket/Display.html?id=73657
+ return "" if $t=~/^\s*$/;
+ # Workaround for discount's eliding
+ # of <style> blocks.
+ # https://rt.cpan.org/Ticket/Display.html?id=74016
+ $t=~s/<style/<elyts/ig;
+ my $r=Text::Markdown::Discount::markdown($t);
+ $r=~s/<elyts/<style/ig;
+ return $r;
+ }
+ }