Markdown validity Re: Agreeing on "Historical Markdown"

Michel Fortin michel.fortin at
Sat Jul 12 14:52:21 EDT 2014

Le 12-juil.-2014 à 10:32, Sean Leonard <dev+ietf at> a écrit :

> Markdown may have a concept of HTML validity. A Markdown processor that identifies HTML in Markdown content may determine that the HTML is valid or invalid. For example, it may identify <div> ... [end of document] as HTML that is invalid because it lacks a closing </div> tag. Then, it has five choices:
> 1. treat the invalid HTML as text--pass the text-as-text to the markup (i.e., turn & into & , < into < , etc.)
> 2. treat the invalid HTML as Markdown--keep on processing the input and look for markdown inside of it (thus *hello* inside the invalid HTML will get marked up...and <div><a href="">hello</a>[end of document] will become a real link with the literal text '<div>' preceding it)
>  <-- this is the same behavior as "not identifying the text as HTML in the first place"
> 3. pass the invalid HTML as HTML
> 4. attempt to fix the HTML...thus <div><a href="">hello</a>[end of document] might become <div><a href="">hello</a></div>
> 5. fail due to HTML invalidity
> ?

Is that really a question?

1. Turning `&` and `<` into `&` and `<` is part of the official syntax rules. Hopefully every Markdown parser does that.

2. 3. 4. 5. We have implementations doing all of that, probably mixing a few of those solutions depending on the exact error.

When you have a question like this, just try it Babelmark 2:

Michel Fortin
michel.fortin at

More information about the Markdown-Discuss mailing list