Wiki/markdown fixes

* Replaced the old code for generating the table of contents with something that better matches what reddit produces.
* A few renderer bug fixes, none of which apply to anything that would have any effect given the settings used by RES.
* Synced renderer with changes to snudown (*again*)