# Markdown Handler for Apache

Here’s something clever: a way to have the Apache webserver automatically render Markdown files as HTML. It’s called Markdown Handler and is available in this GitHub repository.

It works by adding a couple of lines to your Apache httpd.conf file (or, alternatively, your .htaccess file) that assign a “handler” to files ending in .md or .markdown. The handler is a PHP script that passes the Markdown file through PHP Markdown Extra and wraps some boilerplate HTML around it before sending the result off to your web browser.

I learned about it from an RSS notice that appeared in my Google Reader this morning. Alan Lue, Markdown Handler’s maintainer, had started watching my PHP Markdown Extra Math repository.1 In fact, he’s now using PHP Markdown Extra Math as his Markdown processor and loads jsMath in the <head> of the HTML wrapper.

Following the history of Markdown Handler backward in time, I see that Sam Minnée started the project in October of last year. Alan Lue forked it a couple of days ago.

If I weren’t committed to the idea that my PNotes personal wiki system should work without a server, I’d probably be rewriting it to use Markdown Handler. If you write everything in Markdown, as I do, it looks like a great way to run a small site.

1. That’s my customization of PHP Markdown Extra to allow the entry of mathematical equations in a LaTeX style, with jsMath rendering the output.