Insist that code fenced blocks are properly closed

+++ SvenDowideit [Sep 04 14 10:37 ]:

yes please. Having rigorous validity feedback for the writer would help immensely - especially when the ‘compiler’ can give that feedback at the right location - ie, 'Sorry, you started code fenced block here, and need to close it somewhere`

There is no such thing as an invalid Markdown document, according to
this spec (and nearly every implementation). It’s a separate question
whether to issue warnings when we see something that looks like it
was probably not intended. That could definitely be done.

The question what the parser should return with an unclosed open
backtick fence is separate from the issue of warnings. Either option
is probably unintended by the user, so I don’t see a great difference
from that point of view. (Putting the whole rest of the document in
the code block makes it more likely that the error will be noticed.)

From a parsing point of view, it’s much better if you don’t have to
backtrack. The current implementations have the nice property that
they can parse input line by line, throwing away each line after
they parse it.

2 Likes