For those who have been reading this blog for sometime, you know that I’m a fan of using lines of code in my posts.
I’m not referring to the larger code block (I use SyntaxHighlighter Evolved for that), but for code that exists in a single line
much like this. The thing is, when I’m drafting my posts, I often place those strings in backticks – `like this` – and then go through and replace them code tags prior to publishing the post.
And I love Markdown as much as the developer, but I’m not ready to fully abandon the WordPress editor for it. Instead, I’d rather have just a few tags supported that I frequently use and be able to have them replaced automatically.
So I wrote a really simple plugin for doing just that: Markdown Code For WordPress.
Markdown Code For WordPress
Simply put, this plugin will replace all backticks in your post, page, or other custom post type content and replace it with the proper
code tags so that you don’t have to manually do so.
Sure, it’s really simple, but it scratches a nasty itch of mine and will ultimately save me a lot of time.
But as with most projects, I always welcome notes, pull requests, and discussion around it so I placed it on GitHub for exactly that reason.
Honestly, I have no roadmap for this plugin. As I mentioned, it fulfills a need that I’ve for sometime while writing for this blog, so I wrote it for myself and am sharing it just in case anyone else has the same need.
Additionally, I’m not really into leaving the WordPress editor, but I’m not opposed to introducing support for other tags depending on if others use this particular plugin.
A Note About Parsers
For those who are familiar with writing parsers, you know that languages – like markdown – normally include a parser that’s responsible for replacing tokens with their appropriate tags in the grammar.
This plugin does not do that – it’s not mature enough for that. Truth be told, it’d be much easier to wrap the Markdown parser in a WordPress plugin and then call it a day.
Instead, Markdown Code For WordPress uses a simple regular expression for replacing the backticks with code tags.
I mention this so that if this particular project ends up gaining any sort of traction with including support for other tags, then I’d want to make sure that we’re not reinventing the original Markdown parser, and that we’re not simply adding a collection of regular expressions (as creating a parser would be the proper way to go).
You can follow development of Markdown Code For WordPress (though I’m not sure how active it will be) on its corresponding GitHub page. If you want to download the latest version, then you can do so using this link.
As with the rest of the projects, I’m always interested in feedback so feel free to leave some in the comments or on GitHub.
Leave a Reply
You must be logged in to post a comment.