Can WordPress Do Markdown Like Ghost?
One of the often touted benefits of the Ghost blogging platform is its clean and uncluttered writing interface.
Markdown sits at the heart of Ghost’s approach: WYSIWYG is abandoned for the simplicity of text mark-up and a preview screen.
So what are the options for implementing Markdown in WordPress and are any of them worth considering?
Markdown has been around for almost 10 years and is a simple syntax for marking-up plain text for subsequent into delivery formats such as HTML or PDF.
#This is a Heading 1
gets converted to
<h1>This is a heading 1</h1>
The full syntax is available at the website of Markdown’s creator, John Gruber.
Its primary advantages are ease of use, device and format independence and its low overheads.
Markdown Plugins For WordPress
There are a number of Markdown WordPress plugins available. I took four for a test-drive to see if they really could improve the authoring experience:
- Markdown On Save Improved (based on, not surprisingly, the Markdown On Save plugin)
- Markdown QuickTags
Markdown AND a Toolbar?
Ghost has no post editing toolbar; Markdown is, after all, a text-based syntax. It is difficult to argue that it is far more convenient to simply type # My Heading to get an H1 heading rather than type the heading, highlight it and then click on a drop-down of styles and select “Heading 1“.
In fact, that’s the point of Markdown.
Despite this, all four plugins use a toolbar with mark-up producing buttons with WP-Markdown and Markdown QuickTags adding their own set of buttons. Markdown QuickTags actually provides a really nice set of icons.
But why? Isn’t that negating, or at the very least discouraging, one of the key advantages of markdown?
The only buttons that should appear on the toolbar at those that are either WordPress specific, such as More (or other buttons that may add a shortcode) or allow access to extended functionality such as preview or help.
All the plugins also have an image button, which as we’ll see later is a real step backwards.
Help! Where’s the Help?
An author new to Markdown is initially going to need to reference a syntax cheat-sheet fairly constantly until they get up to speed.
Yet, only Markdown QuickTags provided an easy to access to description of Markdown syntax.
The (Mis)Handling of Images
Images are an integral part of many blog posts so their insertion into the code should be just as easy as it is in a full-blown WYSIWYG editor.
Ghost really cheats in this respect by shifting image insertion to the Preview pane, which certainly improves the process although it does seem a little illogical to be editing in a preview.
All four plugins took the same poor route with the insertion of images by providing variations of the default image button from the text toolbar. This does not allow selecting from the Media Library (or uploading a new image) and therefore requires the author to already know the URL.
This is a big step backwards and a big disincentive to installing Markdown in WordPress.
Images can still be added via the Add Media button but this inserts raw HTML into the editor interface which is obviously not desirable.
Authors Need A Preview
Although Markdown is format neutral, it’s a huge help, possibly essential, to be able to preview a post in HTML. Ghost puts the preview right in front of an author by splitting the editor screen in two – one half is Markdown, the other half is Preview.
Only two of the plugins provided a preview: Markdown QuickTags and WP-Markdown with only WP-Markdown providing a very responsive, real-time HTML preview courtesy of its horizontally split editing screen. This approach works well but arguably not as well as Ghost’s vertical split.
Markdown QuickTags‘ preview is on-demand via a toolbar button. It renders well but could require plenty of button pushing during an edit as the author checks that updates are as expected in the HTML version.
When Rendering Takes Place Matters. A lot.
At some point, the Markdown syntax has to be processed and rendered as HTML. The plugins took a variety of approaches making for very different user experiences.
Typewriter renders HTML on the fly at the time of displaying the content in the public interface by hooking into the_content and the_excerpt filters. This could potentially affect site performance but more importantly means that if you decided to stop using the plugin, your posts will simply output Markdown and not HTML.
Markdown QuickTags requires manual rendering at the time of publishing via a Render button underneath the text editor – otherwise the Markdown will be output on the public site. The Render button updates the text editor with the HTML; to edit the post you have to use the Markdownify button.
This having to constantly render and unrender is annoying and a big downside to this plugin. The Markdownify process also breaks shortcodes as it changes as it adds an \ before the [.
WP-Markdown and Markdown After Save Improved are smarter and more logical in their rendering. Both do it on the save action but do not touch the Markdown text but update the post_content_formatted attribute for a post. This doesn’t just mean that the Markdown is preserved but that if the plugin is disabled the HTML for the post is still delivered on the public site.
Are Any Of The Plugins Ready For Prime-time?
The short answer is no.
WP-Markdown is the best Markdown implementation that is currently available with its excellent preview functionality and its ability to be deactivated but to leave the HTML in tact. Its not, however, without its issues not least of which is the lack of a decent image insertion function and easy access to Markdown help.
None of the plugins I looked at are up to the standard of Ghost which may be an unfair comparison given that the plugins have to work within the constraints imposed by the WordPress admin interface.
Is the lack of a decent Markdown implementation a problem?
I like Markdown. It has potential but it cannot be implemented based strictly on a specification that was finalised in December 2004. Ghost realised this and enhanced it with, for example, specific image insertion functionality.
Until the WordPress plugins do the same, I’d suggest sticking with the default WordPress editor.
It may not perfect but it is better than the current Markdown options and it’s obviously good enough for the tens of millions of WordPress users out there to get by.
WIN a Share of $5K
Subscribe to our blog this #hostingmonth for a chance to win one of 5 prizes of $1,000 WPMU Dev credit! Learn More.