Posted: Sunday July 10 2016 @ 8:35pm
Religious Order: Toys
Every few years, I decide that I need to add a feature to PolkaDot, the software on which this blog runs. It's a home-grown system I wrote long ago simply to see if I could write a blogging platform in an evening. Turns out I could!
It's not great software. If this blog received any real traffic, the processing load on the server would surely be noticed by GoDaddy. Luckily, no one really comes here!
For those who don't know, the software works like this:
Categories are simply directories on the server. Drop the text file into whichever category you want.
The problem is that if you want to actually do any formatting, you're stuck embedding HTML into the text. Need a table? Gotta make an HTML table. Need a bullet list? Gotta make an HTML bullet list. It's a pain.
Lately, I've fallen in love with Markdown. It's such a nice middle ground between plain text and things like HTML. I've been using it extensively at work because it's easy to generate it from data, then use existing rendering software to make it pretty on a variety of targets.
So, let's add Markdown to PolkaDot!
Luckily, I didn't have to do much work. There's a great PHP module called Parsedown that let's you convert Markdown to HTML with just a function call. All I had to do was make some modifications so that PolkaDot looked for both text and Markdown files, then handed the Markdown posts to Parsedown, while routing the text posts through the existing raft of search-and-replace madness that turns those into posts.
And that's exactly what I did today. The ordered list above is actually in Markdown. The hyperlinks are Markdown. That's, really, all the Markdown in this post, other than the italics just then.
The only problem right now is that handling both text and Markdown files changed the naming convention for the comment files. (Yes, all the data in the blog is held in simple text files.) I've renamed some, but a bunch remain. So older posts might not show their comments yet.
Calinlg all cars, calling all cars, we're ready to make a deal.