diff --git a/CHANGELOG b/CHANGELOG index 0ffbd4579..de06bcefc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,9 @@ ikiwiki (3.20180106) UNRELEASED; urgency=medium * core: Don't send relative redirect URLs when behind a reverse proxy + * mdwn: Enable fenced code blocks, PHP Markdown Extra-style definition + lists and GitHub-style extensions to HTML tag syntax when used with + Discount >= 2.2.0 (Closes: #888055) -- Simon McVittie Mon, 08 Jan 2018 10:51:10 +0000 diff --git a/IkiWiki/Plugin/mdwn.pm b/IkiWiki/Plugin/mdwn.pm index 9f06c03f2..66116ae01 100644 --- a/IkiWiki/Plugin/mdwn.pm +++ b/IkiWiki/Plugin/mdwn.pm @@ -125,6 +125,31 @@ sub htmlize (@) { $flags |= 0x00400000; } + # Enable fenced code blocks in libmarkdown >= 2.2.0 + # https://bugs.debian.org/888055 + if (Text::Markdown::Discount->can("MKD_FENCEDCODE")) { + $flags |= Text::Markdown::Discount::MKD_FENCEDCODE(); + } + else { + $flags |= 0x02000000; + } + + # PHP Markdown Extra-style term\n: definition ->
+ if (Text::Markdown::Discount->can("MKD_DLEXTRA")) { + $flags |= Text::Markdown::Discount::MKD_DLEXTRA(); + } + else { + $flags |= 0x01000000; + } + + # Allow dashes and underscores in tag names + if (Text::Markdown::Discount->can("MKD_GITHUBTAGS")) { + $flags |= Text::Markdown::Discount::MKD_GITHUBTAGS(); + } + else { + $flags |= 0x08000000; + } + return Text::Markdown::Discount::markdown($t, $flags); } }