From 9dce803faf4dac9ee9249a108e9054e296e1f741 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 1 Jan 2012 16:56:32 -0400 Subject: [PATCH] discount support MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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) 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. --- IkiWiki/Plugin/mdwn.pm | 6 ++++++ debian/changelog | 11 +++++++++++ doc/plugins/mdwn.mdwn | 9 ++++++--- 3 files changed, 23 insertions(+), 3 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 @@ -50,6 +50,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 (! $@) { diff --git a/debian/changelog b/debian/changelog index 6cd19d7c2..a33b3d1b7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +ikiwiki (3.20111230) UNRELEASED; urgency=low + + * 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 + ikiwiki's rendering by a factor of 40. + (However, when multimarkdown is enabled, Text::Markdown::Multimarkdown + is still used.) + + -- Joey Hess Sun, 01 Jan 2012 16:22:24 -0400 + ikiwiki (3.20111229) unstable; urgency=low * Consume all stdin when rcs_receive short-circuits, diff --git a/doc/plugins/mdwn.mdwn b/doc/plugins/mdwn.mdwn index ce1b6097a..8a7308305 100644 --- a/doc/plugins/mdwn.mdwn +++ b/doc/plugins/mdwn.mdwn @@ -8,9 +8,12 @@ This is the standard markup language used by ikiwiki, although some others are also available in other plugins. There are several implementations of markdown support that can be used by -this plugin. The [original version of -markdown](http://daringfireball.net/projects/markdown/) can be used, or the -[[!cpan Text::Markdown]] perl module. +this plugin. In order of preference: + +* [Discount](http://www.pell.portland.or.us/~orc/Code/discount/), + via the [[!cpan Text::Markdown::Discount]] perl module. +* The [[!cpan Text::Markdown]] perl module. +* The [original version of markdown](http://daringfireball.net/projects/markdown/). [[!cpan Text::MultiMarkdown]] can be used in order to use tables, footnotes, and other new features from the markdown variant called -- 2.26.2