Note that similar confusion seems to occur with HTML blocks.
If you take example 173. This example has a final empty line which according to the test is ignored.
However if you add blanks on this final line then while the dingus still ignores the final line, neither cmark
nor md2html
do (they include the final blank line):
> printf '<style\n type="text/css">\n\nfoo\n ' | cmark --unsafe
<style
type="text/css">
foo
> printf '<style\n type="text/css">\n\nfoo\n ' | md2html
<style
type="text/css">
foo
So I guess something need fixing, either the spec or these implementations. The spec says:
Blank lines at the beginning and end of the document are also ignored.
But first that’s ambiguous, is it one line at the beginning and one at the end or multiple lines ? And at least for the cmark
reference implementation on code blocks and HTML that’s one empty (vs blank) final line that gets ignored.
> printf '```\n \n' | cmark
<pre><code>
</code></pre>
> printf '```\n \n ' | cmark
<pre><code>
</code></pre>
> printf '```\n \n \n' | cmark
<pre><code>
</code></pre>
> printf '```\n \n \n \n' | cmark
<pre><code>
</code></pre>
(md2html
behaves similarly)