Markdown support for Midgard

Midgard CMS has now support for the Markdown text-to-HTML conversion tool. Markdown is an useful tool for writers that allows creation of web content with a simple text syntax.

Markdown is available in MidCOM's CVS repository as datatype_markdown. The tool utilizes Michel Fortin's PHP Markdown parser.

To use Markdown for a content field in your MidCOM site, edit the datamanager schema and set the field to use the markdown datatype. For example:

"content" => array (
"description" => "Content",
"datatype" => "markdown",
"location" => "content",
),

My blog is still powered by htmlArea, but I'm planning to start migrating new entries to Markdown as soon as I upgrade the blog's version of MidCOM. I'll blog about that later.

Updated 2005-03-03: The blog is now using Markdown as the default editing system for new blogs. As I didn't want to modify existing blog posts, I made two copies of the schema, and named them "default" and "html". Then I ran the following query through my blog entries:

$blog_topic = mgd_get_topic_by_name($GLOBALS["midcom_site"]["root_topic"]->id,"blog");
$blogs = mgd_list_topic_articles($blog_topic->id);
if ($blogs) {
while ($blogs->fetch()) {
$blogs->parameter("midcom.helper.datamanager","layout","html");
}
}

This ensured that the old posts will be using the "html" schema, freeing the "default" schema to be used with Markdown. Now when I post through Metaweblog API (using Marsedit), the post formatting will be Markdown, and when I create posts through the web I can choose between Markdown and HTML:


Sweet! Kaukola also posted some notes on Markdown usage to Nemein's IT policy.



Read more Midgard posts.