commonmark-spec icon indicating copy to clipboard operation
commonmark-spec copied to clipboard

Explictly state that indented code blocks must end with newline

Open jo-so opened this issue 6 years ago • 3 comments

The input *** without a newline at the end gets a newline added by the current dingus. This is sensible, because a normal fenced code block as a trailing newline.

```
code to the end

The same should be required for fenced code blocks without a closing fence.

jo-so avatar Sep 23 '19 09:09 jo-so

An exception is the empty block as in example 96.

jo-so avatar Sep 23 '19 09:09 jo-so

In conflict with this the HTML blocks strip the trailing newline: https://spec.commonmark.org/dingus/?text=%3Cdiv%3E%0A***%0A

jo-so avatar Sep 23 '19 11:09 jo-so

cmark seems to diverge from commonmark.js (the code used on the dingus) for this latter case:

 % cmark -t xml
<div>
...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document SYSTEM "CommonMark.dtd">
<document xmlns="http://commonmark.org/xml/1.0">
  <html_block>&lt;div&gt;
...
</html_block>
</document>

commonmark.js:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document SYSTEM "CommonMark.dtd">
<document xmlns="http://commonmark.org/xml/1.0">
  <html_block>&lt;div&gt;
...</html_block>
</document>

jgm avatar Sep 24 '19 00:09 jgm