Markdown Gets Code Blocks

I don’t use Markdown because, as an Emacs user, I have access to the superior Org Mode. Still, if you’re not an Emacs user, Markdown provides a subset of Org Mode’s capabilities and is definitely an excellent piece of software (although it does have some problems).

One of the most useful facilities that Org Mode provides is code blocks—what they used to call Babel—that allows you to embed executable code in an Org document, execute it, and automatically embed the results in the document. I’ve written about it many times.

Now Vittorio Zaccaria is bringing code blocks to Markdown with exemd. It’s a preprocessor for Markdown that executes embedded code blocks and inserts the results into the document. The project is still evolving and some of the planned functionality is still not implemented but what he has so far is impressive. More plugins need to be written and PDF output is still unimplemented but the project is off to an excellent start.

A real problem with exemd is that it lacks the integration that Org Mode has with its host editor. How could it be otherwise? After all, Markdown works with any editor so unless every editor builds in an interface this will continue to be a problem. Another issue is that, for the same reasons, there is not a central place to get those plugins; there’s no universal package system. Zaccaria can address the last problem by hosting or listing those modules on the Exemd site.

One further possible problem is that, as far as I can see, the only way to get exemd is through npm, which leads me to believe that it may be available only for Linux. I hope I’m wrong about that because it looks like a really useful package that users on all platforms could benefit from.

I’m really happy to see this capability added to Markdown. It’s extraordinarily useful and encourages reproducible research by making it easier. I hope this project keeps going and succeeds.

UPDATE: npm is available for all platforms so, happily, exemd should be usable by all Markdown users.

This entry was posted in General and tagged , . Bookmark the permalink.