- eval q{use Markdown};
- if ($@) {
- do "/usr/bin/markdown" ||
- IkiWiki::error("failed to load Markdown.pm perl module ($@) or /usr/bin/markdown ($!)");
+ if (exists $config{multimarkdown} && $config{multimarkdown}) {
+ eval q{use Text::MultiMarkdown};
+ if ($@) {
+ debug(gettext("multimarkdown is enabled, but Text::MultiMarkdown is not installed"));
+ }
+ $markdown_sub=sub {
+ Text::MultiMarkdown::markdown(shift, {use_metadata => 0});
+ }
+ }
+ if (! defined $markdown_sub) {
+ eval q{use Text::Markdown};
+ if (! $@) {
+ if (Text::Markdown->can('markdown')) {
+ $markdown_sub=\&Text::Markdown::markdown;
+ }
+ else {
+ $markdown_sub=\&Text::Markdown::Markdown;
+ }
+ }
+ else {
+ eval q{use Markdown};
+ if (! $@) {
+ $markdown_sub=\&Markdown::Markdown;
+ }
+ else {
+ do "/usr/bin/markdown" ||
+ error(sprintf(gettext("failed to load Markdown.pm perl module (%s) or /usr/bin/markdown (%s)"), $@, $!));
+ $markdown_sub=\&Markdown::Markdown;
+ }
+ }