diff --git a/IkiWiki/Plugin/mdwn.pm b/IkiWiki/Plugin/mdwn.pm
index c1f978ad3..8e037f5de 100644
--- a/IkiWiki/Plugin/mdwn.pm
+++ b/IkiWiki/Plugin/mdwn.pm
@@ -10,16 +10,24 @@ sub import { #{{{
IkiWiki::hook(type => "htmlize", id => "mdwn", call => \&htmlize);
} # }}}
+my $markdown_loaded=0;
sub htmlize ($) { #{{{
my $content = shift;
- if (! $INC{"/usr/bin/markdown"}) {
- # Note: a proper perl module is available in Debian
+ if (! $markdown_loaded) {
+ # Note: This hack to make markdown run as a proper perl
+ # module. A proper perl module is available in Debian
# for markdown, but not upstream yet.
no warnings 'once';
$blosxom::version="is a proper perl module too much to ask?";
use warnings 'all';
- do "/usr/bin/markdown" || IkiWiki::error("failed to load /usr/bin/markdown: $!");
+
+ eval q{use Markdown};
+ if ($@) {
+ do "/usr/bin/markdown" ||
+ IkiWiki::error("failed to load Markdown.pm perl module ($@) or /usr/bin/markdown ($!)");
+ }
+ $markdown_loaded=1;
require Encode;
}
diff --git a/debian/changelog b/debian/changelog
index c89500109..c83c8bce0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,9 +9,13 @@ ikiwiki (1.17) UNRELEASED; urgency=low
* Remove
from end of aggregate preprocessor directive output.
* Ship ikiwiki executable as ikiwiki.pl in source to avoid issues on
case-sensative filesystems like OSX.
- * Display an error message if /usr/bin/markdown can't be loaded.
+ * Improve markdown loading. First, try to load it as a properl perl module,
+ in case it was installed as one. Then fall back to trying
+ /usr/bin/markdown.
+ * Document in install page how to install markdown, since it has no
+ installation procedure in the upstream tarball.
- -- Joey Hess Wed, 9 Aug 2006 23:01:02 -0400
+ -- Joey Hess Wed, 9 Aug 2006 23:50:25 -0400
ikiwiki (1.16) unstable; urgency=low
diff --git a/doc/install.mdwn b/doc/install.mdwn
index d2b6b8833..49153c0d0 100644
--- a/doc/install.mdwn
+++ b/doc/install.mdwn
@@ -6,6 +6,10 @@ installed, and also uses the following perl modules if available:
`HTML::Template` `Mail::SendMail` `Time::Duration` `Date::Parse`,
`HTML::Scrubber`, `RPC::XML`, `XML::Simple`, `XML::Feed`
+If you're installing MarkDown by hand, note that it should be installed as
+`Markdown.pm` somewhere in perl's module search path, or alternately as
+`/usr/bin/markdown`. Ikiwiki will find it under either name.
+
If you want to install from the tarball, you should make sure that the
required perl modules are installed, then run:
diff --git a/doc/markdown/discussion.mdwn b/doc/markdown/discussion.mdwn
deleted file mode 100644
index dd63f1704..000000000
--- a/doc/markdown/discussion.mdwn
+++ /dev/null
@@ -1 +0,0 @@
-in order to install Markdown, I had to copy the Markdown.pl file to /usr/bin/markdown
\ No newline at end of file
diff --git a/doc/plugins/orphans.mdwn b/doc/plugins/orphans.mdwn
index 2c4e52a3f..4591ebf59 100644
--- a/doc/plugins/orphans.mdwn
+++ b/doc/plugins/orphans.mdwn
@@ -1,5 +1,5 @@
-This plugin generates a list of possibly orphaned pages -- pages that no other page
-links to.
+This plugin generates a list of possibly orphaned pages -- pages that no
+other page links to.
The optional parameter "pages" can be a [[PageSpec]] specifying the pages
to check for orphans, default is search them all.
diff --git a/doc/sandbox/foo.wiki b/doc/sandbox/foo.wiki
index 7e58da046..e06baad61 100644
--- a/doc/sandbox/foo.wiki
+++ b/doc/sandbox/foo.wiki
@@ -1 +1 @@
-Look ma, this page uses '''wiki''' markup, not MarkDown! :-)
\ No newline at end of file
+Look ma, this page uses '''wiki''' markup, not MarkDown! :-)