diff options
author | Simon McVittie <smcv@debian.org> | 2018-01-23 09:39:05 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2018-01-29 22:35:29 +0000 |
commit | f46e429d96ead32943cb2670d7686df8c77de361 (patch) | |
tree | a51ce4117727e617692f073f8c9ff5bad16256c6 /IkiWiki | |
parent | 400f37967ccca314a052cb3eef7e2863a91ca477 (diff) | |
download | ikiwiki-f46e429d96ead32943cb2670d7686df8c77de361.tar ikiwiki-f46e429d96ead32943cb2670d7686df8c77de361.tar.gz |
mdwn: Restore historical behaviour
The Discount package in Debian historically enabled fenced code blocks,
PHP Markdown Extra-style definition lists, and an expanded character
set for tag names. Since Discount 2.2.0 those are runtime settings, so
enable them. Unfortunately Text::Markdown::Discount doesn't yet expose
the necessary constants:
https://rt.cpan.org/Public/Bug/Display.html?id=124188
The IDANCHOR option was historically also enabled in Debian, but is not
enabled here because ikiwiki does not enable the TOC option, and
IDANCHOR does nothing without TOC.
Closes: #888055
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/mdwn.pm | 25 |
1 files changed, 25 insertions, 0 deletions
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 -> <dl> + 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); } } |