aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/mdwn.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2012-01-01 16:56:32 -0400
committerJoey Hess <joey@kitenet.net>2012-01-01 17:28:31 -0400
commit9dce803faf4dac9ee9249a108e9054e296e1f741 (patch)
tree389b67c066d6ec833d9bf2364bf67588591527e8 /IkiWiki/Plugin/mdwn.pm
parent28e66cd34a157f31012e6b0be4afa2457a0c9f08 (diff)
downloadikiwiki-9dce803faf4dac9ee9249a108e9054e296e1f741.tar
ikiwiki-9dce803faf4dac9ee9249a108e9054e296e1f741.tar.gz
discount support
mdwn: Can use the discount markdown library, via the Text::Markdown::Discount perl module. This is preferred if available since it's the fastest currently supported markdown library, speeding up markdown rendering by a factor of 40. That is to say, when only rendering a lot of markdown, discount is 40x faster. When building a ikiwiki site, ikiwiki's other overhead gets in the way, but I still see significant speedups. Building the ikiwiki docwiki dropped from 62 to 45 seconds, for example. However, when multimarkdown is enabled, Text::Markdown::Multimarkdown is still used. While discount contains some nonstandard markdown extensions, including tables and footnotes, AFAICS most of them are not enabled by default in the perl bindings. I consider sticking to non-extended markdown a desirable thing, since this is probably not the last markdown engine. In particular, sundown is waiting in the wings to get packaged and get a perl binding. ---- Reviewing all the showdown extensions, here are the ones that are enabled: centered paragraphs: ->centered<- image sizes: [dust mite](http://dust.mite =150x150) <style>..</style> blocks are eaten. The perl binding does not provide access to the gathered CSS. This is not legal html anyway, so unlikely to cause breakage.
Diffstat (limited to 'IkiWiki/Plugin/mdwn.pm')
-rw-r--r--IkiWiki/Plugin/mdwn.pm6
1 files changed, 6 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/mdwn.pm b/IkiWiki/Plugin/mdwn.pm
index b892eabee..0dc0cc336 100644
--- a/IkiWiki/Plugin/mdwn.pm
+++ b/IkiWiki/Plugin/mdwn.pm
@@ -51,6 +51,12 @@ sub htmlize (@) {
}
}
if (! defined $markdown_sub) {
+ eval q{use Text::Markdown::Discount};
+ if (! $@) {
+ $markdown_sub=\&Text::Markdown::Discount::markdown;
+ }
+ }
+ if (! defined $markdown_sub) {
eval q{use Text::Markdown};
if (! $@) {
if (Text::Markdown->can('markdown')) {