Refactor URL rewriting

Use a Markdown extension to hook into the build process and modify the
HTML document tree rather than using regular expressions to process
the HTML.

Fixes #240
Docstring with what and why maybe?

Eg. example of before and after link.