Markdown Monster

In 2024, the YAML Monster was published – a YAML file that parses differently in 3 different YAML parsers. It was followed by the Safe YAML Monster, which does not use “unsafe” methods and can distinguish 6 different parsers. These were supposed to demonstrate that YAML is a complex language whose parser is hard to implement correctly.

However, there exists a popular format which is even more complex than YAML, despite being constantly praised for its simplicity: Markdown. This document is supposed to demonstrate just how bloated and riddled with edge cases Markdown is. It can distinguish 24 different Markdown implementations. Simply render the document using one of the supported parsers and follow the instructions starting at Section 0 to identify which parser was used.

The document was made with huge help from babelmark, which provided me with the test cases as well as their outputs in many Markdown implementations. All that was left for me to do was write a program to scrape the data and generate a decision tree, which I then manually turned into this monstrosity. Unfortunately, all the Rust implementations of Markdown were broken, so they are not included.

Section 0

Look at what is displayed between START and END.

START

  • --

--

END

  • If there is a list with one empty item and two identical empty sections named “--”, go to Section 1.
  • If there are two sections, one empty named “-” and one named “---” with the text “-”, go to Section P.
  • If there are two empty sections, one named “-” and one named “--”, you are using cebe/markdown. Go to Section C to determine which flavor you have selected.
  • If there is a list with two items, one containing a section titled “--” with the text “--” and the other empty, go to Section P′.
  • If there is a list with two items, one containing a section titled “” with the text “” and the other empty, you are using Pandoc.
  • If there are two empty sections, one named “-” and one named “”, you are using MultiMarkdown.
  • If there is a section named “-” with the text “-”, you are using Gambas.
  • If there is a section named “-” with the text “– -”, you are using s9e/textFormatter.
  • If there is a list with one item “--”, a horizontal rule and an empty section named “--”, you are using Mistletoe.
  • If there is a list with one empty item, a paragraph with the text “--”, a horizontal rule, and a paragraph with the text “-- -”, you are using pmarkdown with the default mode.
  • If there is a list with one empty item and two unnamed empty sections, you are using flexmark-java.
  • If there are five horizontal rules, you are using Maruku.

Section 1

Look at the following paragraph.

link [in link](/url1)

  • If there is one link surrounded by non-link text, go to Section 2.
  • If there is one link alone, you are using IntelliJ Markdown.
  • If there are two links, you are using Marked.

Section 2

Look at what is displayed between START and END.

START

hi

END

  • If it says “hi”, go to Section 3.
  • If it says “hi” surrounded by DIV tags, you are using markdown-it.
  • If there is nothing, you are using pycmarkgfm.

Section 3

Look at the following paragraph:

hi***there

  • If there is one asterisk and the word “there” is emphasized, go to Section 4.
  • If there are three asterisks and the word “there” is not emphasized, you are using markdig.

Section 4

Look at the list between START and END.

START

  • top
  • indented one
  • indented two
  • indented three - indented four

END

  • If the list has four items, go to Section 5.
  • If the list has five items, you are using commonmark.js.

Section 5

Is the following paragraph a link?

[hi](/url(with parens))

  • If not, you are using commonmark-java or league/commonmark.
  • If yes, you are using pmarkdown with the cmark mode.

Section C

Look at the numbered list between START and END.

START

  1. a
  • x
  • y
  1. b
  • x
  • y

END

  • If it contains two sublists, you are using the gfm flavor of cebe/markdown.
  • If it contains two simple paragraphs, you are using the extra flavor of cebe/markdown.

Section P

Look at what is displayed between START and END.

START

  1. item 1
  2. item 2
  3. item 2a

END

  • If there is a list with three items, you are using Python Markdown.
  • If there is one list with two items numbered 1. and 2., you are using PHP Markdown.
  • If there is one list with two items numbered 8. and 9., you are using PHP Markdown Extra.

Section P′

Look at what is displayed between START and END.

START

  • one
  • three

END

  • If there are two items “one” and “three”, you are using Parsedown.
  • If there are three items, you are using Pandoc with strict mode.