Markdown in WordPress

Markdown-mark.svgI’ve been writing a lot of prose over the past year – lesson plans, online content, blog posts, etc. As more of my prose has also involved code samples, I’ve gravitated toward Markdown for writing my text for a few reasons:

  • It’s dead simple to incorporate code blocks
  • It’s cleaner to look at than raw HTML
  • There are plenty of great tools that support it (for me those include Jupyter Notebook and The Iron Yard’s online learning platform)

(Yes, there are also reasons not to use Markdown)

But I never made the jump to using it on my blog. Until today!

I decided to look at what the state of the art was. A quick search of WordPress plugins showed me that the most obvious plugin (wp-markdown) hadn’t been updated in two years, and wasn’t compatible with the current version of WordPress. Welp, rule that one out.

Then I discovered that it’s a feature supported by WordPress.com. But what about me? I self-host!

Not to worry – Jetpack has me covered.

I’d never used Jetpack before – I assumed it was just an attempt to upsell me into some extra analytics that I just don’t care for. However, it also has a bunch of groovy features that aren’t part of WordPress core, and a lot of them are available for free, including Markdown.

After installing Jetpack, you have to link it to a wordpress.com account. It’s free if you don’t already have one.

Once the plugin itself is activated, you can skip their suggested features to activate and go to the Jetpack manager, where you just need to activate the Markdown feature.

Then without much fanfare, you can start incorporating Markdown into your posts/pages. I prefer writing them in the plain text editor (or even a separate editor, such as Atom for syntax highlighting). You can click the Preview button to be sure they’re rendering correctly.

What’s great about the Jetpack plugin is that it doesn’t break your previous posts and it keeps the Markdown with the post. The Markdown is rendered when the page is rendered, so if I need to edit a page, my original Markdown is kept intact. If for some reason I want to use the Visual Editor, it’s still there too!

And in case you were wondering, yes, this post was written in Markdown.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.