mdwn: Add a multimarkdown setup file option.

master
Joey Hess 2008-05-13 12:43:25 -04:00
parent d06e4c2c33
commit fba4a198b5
6 changed files with 43 additions and 8 deletions

View File

@ -17,15 +17,19 @@ sub htmlize (@) { #{{{
if (! defined $markdown_sub) {
# Markdown is forked and splintered upstream and can be
# available in a variety of incompatible forms. Support
# them all.
# available in a variety of forms. Support them all.
no warnings 'once';
$blosxom::version="is a proper perl module too much to ask?";
use warnings 'all';
eval q{use Markdown};
if (! $@) {
$markdown_sub=\&Markdown::Markdown;
if (exists $config{multimarkdown} && $config{multimarkdown}) {
eval q{use Text::MultiMarkdown};
if ($@) {
error(gettext("multimarkdown is enabled, but Text::MultiMarkdown is not installed"));
}
$markdown_sub=sub {
Text::MultiMarkdown::markdown(shift, {use_metadata => 0});
}
}
else {
eval q{use Text::Markdown};
@ -38,11 +42,18 @@ sub htmlize (@) { #{{{
}
}
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;
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;
}
}
}
require Encode;
}

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
ikiwiki (2.47) UNRELEASED; urgency=low
* mdwn: Add a multimarkdown setup file option.
-- Joey Hess <joeyh@debian.org> Tue, 13 May 2008 12:30:18 -0400
ikiwiki (2.46) unstable; urgency=low
* amazon_s3: New plugin, which injects wiki pages into Amazon S3, allowing

View File

@ -133,6 +133,8 @@ use IkiWiki::Setup::Standard {
# Attempt to make hardlinks to source files instead of copying them.
# Useful if the wiki contains large media files.
#hardlink => 1,
# Enable use of multimarkdown features in .mdwn files.
#multimarkdown => 1,
# To add plugins, list them here.
#add_plugins => [qw{goodstuff search wikitext camelcase

View File

@ -6,3 +6,15 @@ It uses the [[ikiwiki/markdown]] minimal markup language.
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.
[[cpan Text::Markdown]] also includes a markdown varient called
[multimarkdown](http://fletcherpenney.net/MultiMarkdown/), which supports
tables, footnotes, and other new features. Multimarkdown is not enabled by
default, but can be turned on via the `multimarkdown` option in the setup
file. Note that multimarkdown's metadata and wikilinks features are
disabled when it's used with ikiwiki.

View File

@ -30,3 +30,6 @@ MultiMarkdown would solve the BibTex request and the multiple output formats wou
> Unless there's a way to disable a zillion of the features, please **no**. Do _not_ switch to it. One thing that I like about markdown as opposed to most other ASCII markup languages, is that it has at least a bit of moderation on the syntax (although it could be even simpler). There's not a yet another reserved character lurking behind every corner. Not so in multimarkdown anymore. Footnotes, bibliography and internal references I could use, and they do not add any complex syntax: it's all inside the already reserved sequences of bracketed stuff. (If you can even say that ASCII markup languages have reserved sequences, as they randomly decide to interpret stuff, never actually failing on illegal input, like a proper language to write any serious documentation in, would do.) But tables, math, and so on, no thanks! Too much syntax! Syntax overload! Bzzzt! I don't want mischievous syntaxes lurking behind every corner, out to get me. --[[tuomov]]
> ikiwiki already supports MultiMarkdown, since it has the same API as MarkDown. So if you install it as Markdown.pm (or as /usr/bin/markdown), it should Just Work. It would also be easy to support some other extension such as mmdwn to use multimarkdown installed as MuliMarkdown.pm, if someone wanted to do that for some reason -- just copy the mdwn plugin and lightly modify. --[[Joey]]
> There's now a multimarkdown setup file option that uses
> Text::MultiMarkdown for .mdwn files. [[done]] --[[Joey]]

View File

@ -15,5 +15,6 @@ use IkiWiki::Setup::Standard {
syslog => 0,
userdir => "users",
usedirs => 0,
multimarkdown => 1,
add_plugins => [qw{goodstuff version haiku polygen fortune}],
}