robinadr

Tagged Markdown

I’ve created a WordPress plugin that uses Parsedown as a Markdown processor. I actually finished version 0.1 a few weeks ago, but I wanted to iron a few bugs out before I announced it publicly.

It functions as a 100% drop-in replacement for the original Markdown plugin, PHP Markdown Extra by Michel Fortin. Everything is the same, down to the same filter behaviors and priorities.

Unlike other plugins, my plugin has no settings. Just upload the plugin, activate it, and you’re off.

Download Parsedown for WordPress v0.3.

The plugin’s page in the WordPress repository has more information. Development takes place over on GitHub, where you can also report any bugs you come across.

If you’re looking for a live example, this site is currently using the latest version.

Ever since I started using the PXS Mail Form plugin in favor of WP-ContactForm for my contact page, I always had problems with it conflicting with the Markdown plugin. Namely, that it disabled the Markdown formatting, and left me with a pile of rubbish.

At the time I decided to keep Markdown and disabled PXS Mail Form, and my contact page took a vacation, but I finally managed to take some time to look a little deeper. Turns out, it’s pretty obvious. Lines 467 through 472:

~~~ .prettyprint remove_filter(‘the_content’, ‘Markdown’, 6); // [… snipped some …] add_filter(‘the_content’, ‘pxs_callback’, 1);


D'oh. In case that doesn't make sense to you, it's actually taking the `Markdown()` filter *off* and putting its own as priority 1. That's not good. I ended up changing it to:

~~~ .prettyprint
//remove_filter('the_content', 'Markdown', 6);
// [... snipped some ...]
add_filter('the_content', 'pxs_callback', 14);

So now the line removing Markdown() is commented out, and I lowered (so to speak) the priority of pxs_callback() to 14, and it all works great. Just in case someone else runs into this.