Making the Case Against Markdown
For some reason, Markdown has not just become the format of choice for giving READMEs in GitHub repositories some flair, but also for writing entire websites and documents. In a recent rant, [Burak Güngör] covers all the ways in which Markdown is a good idea as a basic document formatting concept and how its implementation is absolutely atrocious.
Even without straying into the minefields helpfully provided by other Markdown dialects beyond CommonMark, there is already plenty here to indulge in. The very idea of Markdown as a ‘simple text formatting syntax’ breaks down the moment you look at the available formatting styles and how they translate into HTML. Worse, the sheer complexity of parsing Markdown makes it vulnerable to a regular expression denial-of-service (ReDoS) attack.
This is where the question arises of whether Markdown is truly a text formatting aid or trying to be a programming language that just happens to usually spit out HTML documents, as, at some point, you’re basically writing something that approaches a regular expressions engine in its nightmarish implications.
Where things really fly off the rails is with inline HTML in Markdown, as this also means that you have to add an HTML parser to your Markdown parser to be Fully Compliant. All of which doesn’t even yet take into account the special tags and formatting that things like GitHub-Flavored Markdown add. Yet even without that baggage, we can already enjoy the pleasures that inline HTML-related CVEs bring, including XSS CVEs.
Ultimately, [Burak]’s argument is that Markdown could be a good, simple document formatting tool if it actually tried to be one, which is something with which we can only wholeheartedly agree. When a simple text document is often enough for something like a changelog, and HTML is better suited for more than the most basic of formatting, Markdown seems to have trouble picking what it wants to be.
Considering that it’s often much easier to use HTML tags in a ‘Markdown’ README file for things like tables and images, it’s hard to say exactly where Markdown fits. The skeptic might say that if you’re going to add inline HTML as a feature, you may as well skip the ‘Markdown’ part.
What do you think? How do you generate simple documents? Love Markdown? Hate it? Let us know in the comments. For real fun, try using Markup for graphics.