Trailing newlines in code blocks

Both indented and fenced code blocks generate a trailing newline. If that’s what’s desired, it should be easy to produce one. But it should also be easy to produce a code block without a trailing newline.

Thus:

    This is a code block

should produce

<pre><code>This is a code block</code></pre>

If you want a trailing newline, insert one:

    This is a code block with a trailing newline
      ⁢

to obtain

<pre><code>This is a code block
</code></pre>

Does it actually make a difference to HTML output whether there is a newline at the end of the code?

Of course it does. <pre> is whitespace (including linebreak) preserving. In any browsers,

<pre><code>This is a code block
</code></pre>

has more trailing whitespace at the bottom (the equivalent of an extra blank line) than

<pre><code>This is a code block</code></pre>

Try it yourself and see.

I don’t see additional empty line (Firefox, Chromium).

<style>
pre { border: 1px solid; }
</style>
<pre><code>This is a code block
</code></pre>
123
<pre><code>This is a code block</code></pre>

Hmmm. Fascinating. A leading newline is preserved, but a trailing newline is stripped:

<style>
pre { border: 1px solid; }
</style>
<pre><code>
This is a code block
</code></pre>

(at least in the browsers I’ve tested). I guess I withdraw the comment, then …

Yes, leading and tailing line breaks are completely different things.

Code blocks are ok IMHO.