"Hello World!" from a Markdown file.

Make it work

Getting this to work, I realized the following bits are needed:

The package markdown

This has to be installed into the Python environment. Thanks to my Nix based environment this is just a tiny tweak:

diff --git a/default.nix b/default.nix
index 3b657f2..84cc98a 100644
--- a/default.nix
+++ b/default.nix
@@ -31,6 +31,7 @@ stdenv.mkDerivation {
     ./.;
   buildInputs = [
     pelican
+    pythonPackages.markdown
   ];
   buildPhase = ''
     make publish

For a moment I thought about extending the package pelican itself in nixpkgs and add markdown always, then concluded that is not the right way since Pelican is just fine without Markdown at all.

Metadata has to start on the first line

Took me a few runs to realize that it matters to avoid any blank lines in the beginning of the file:

BLANK
Title: Hello Markdown World

This did fail with the following error report:

ERROR: Skipping ./hello-world.md: could not find information about 'NameError: title'

Why do I want this

First of all, I actually prefer Restructured Text since I find it nicer to read in source form.

On the other side, I keep most of my notes in plain text, usually based on Orgmode in Emacs. For this I have a working Markdown export already set up and make heavy use of it. This turned out to be a nice way for me to prepare my notes for tools like Issue trackers and the like, these often support Markdown.

So that is a proven and stable workflow already for me. Activating this in Pelican allows me to leverage this setup even more. It avoids that I have to figure out how to export into Restructured Text from Orgmode for the moment.

Here is how it looks in source

The following lines are the head of this file, saved as hello-markdown.md.

Title: Hello Markdown World
Date: 2016-02-11

"Hello World!" from a Markdown file.

Comments

comments powered by Disqus