A few weeks ago I published a Drumkit script that lets you publish your post from Drummer to WordPress. It works fine, but I had one small bug I needed to fix and one nice-to-have for myself. I can say I fixed both!
First, in the original Drumkit script I have a few lines with HTML in it. When you have an (inline) image in your post, you want it to show properly on your WordPress blog. So I surrounded it with the basic tags for an image. Unfortunately Drummer, where the script lives, mangles this HTML every now and again. It tries to render the HTML when you open the script and it adds a few characters. It was all kind of weird. An to be honest, using HTML in a script like this never felt good to me.
So when I read about Dave’s plans to include Markdown support an idea hit me. My WordPress blog supports Markdown as well. So why not send the blogpost as Markdown and let WordPress figure it all out? So that’s what I did, especially with the images. Instead of using HTML in the script, I surround the image with the Markdown equivalent.
Since I don’t pay enough attention to filenames, they sometimes can have spaces in them. I had to replace these with
%20 so my Markdown processor in WordPress will not choke on it. Thank you for multipleReplaceAll in the Drumkit scripting language.
The second thing I wanted is to add a link back from the WordPress post to my Oldschool blog. I had some great help from Dave and Amit to figure out how to build the URL to my post. This script from Amit was all I needed. It just worked. I added the script to mine, build a small link back to the original blogpost and I can publish it.
Here is my new script to publish from Drummer to WordPress, using Markdown and have a link back to the original!
Eerder gepost op mijn Oldschool Drummer blog