As we work with WordPress, we have found a few deficiencies in their ability to handle posts formatted in Markdown using their normal post creation and editing tools. While their “classic” editor available from the Dashboard has a Text tab that is mostly usable for small posts, their new (aka “Beep Beep Boop”) editor is simply unable to handle Markdown at all.
Our current work-around is to use the Markdown editor provided by StackEdit. This is a WYSIWYG editor that runs in your web browser, stores documents in your browser’s local storage, can synchronize with cloud services like Dropbox and Google Drive, and knows how to post to several blogging platforms including WordPress.
After you publish a post at WordPress, you can still edit it in StackEdit and update the site with your changes.
It does have some rough spots, the biggest for me being that edits made to a post through WordPress.com cannot be synchronized back into StackEdit. Also, while it has support for listing tags, setting the final post title, uploading as a draft, and suggesting a posting date, it does not have any support for WordPress post categories or post formats.
I’ve configured StackEdit to make my workflow on to WordPress as smooth as I can. This primarily consists of two changes.
To publish pure Markdown to WordPress, in the Publish on WordPress dialog I use Format: Template, check Custom Template, and make sure the box contains something like this to get just the Markdown content without the YAML forematter:
<%= strippedDocumentMarkdown %>
I’ve modified the default document content to look like:
--- title: tags: published: false --- `Written with [StackEdit](https://stackedit.io/).`
The block delimited by
--- lines is a YAML format block that StackEdit will interpret when it uploads the post. This feature was inspired by a similar feature in the jekyll static site building tool, and similar (but not identical) to capabilities of Pandoc. The YAML forematter block can set the published post title, tags, published status, and the posting date. I preset the items I use most often as a reminder to set the title and tags while composing the post.
The tags field should be set with a YAML array, something like:
[one, two, third tag, four].
I could also add a
date: field to the YAML block, but if the post is a draft, I generally don’t bother since I will need to interact with WordPress anyway to set the category, confirm the tags, and schedule the post from the Dashboard.
To publish a post immediately rather than making it a draft, simply remove the
published: false line from the YAML block.