commonmark/commonmark-spec

`html_block` needs an empty line to start parsing md again

Closed this issue · 2 comments

<details><summary>Click to expand</summary>
```
* Major

* Minor
```
</details>

results in:

Click to expand ``` * Major
  • Minor
</details>
Details: AST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document SYSTEM "CommonMark.dtd">

<document xmlns="http://commonmark.org/xml/1.0">
  <html_block>&lt;details&gt;&lt;summary&gt;Click to expand&lt;/summary&gt;
```
* Major</html_block>
  <list type="bullet" tight="true">
    <item>
      <paragraph>
        <text>Minor</text>
      </paragraph>
    </item>
  </list>
  <code_block>&lt;/details&gt;
</code_block>
</document>

Whereas:

<details><summary>Click to expand</summary>

```
* Major

* Minor
```
</details>
Click to expand
* Major

* Minor
Details: AST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document SYSTEM "CommonMark.dtd">

<document xmlns="http://commonmark.org/xml/1.0">
  <html_block>&lt;details&gt;&lt;summary&gt;Click to expand&lt;/summary&gt;</html_block>
  <code_block>* Major

* Minor
</code_block>
  <html_block>&lt;/details&gt;</html_block>
</document>

Is this bug, or feature?

Reproduced also in Dingus https://spec.commonmark.org/dingus/

image

PS: Github actually "self-medicates" for that, by adding empty lines "around" user's input, when they press the "Add a collapsible section" button

PPS: I used <details open> on the examples, to make the issue immediately obvious. Issue was found originally with <details>. Either way "I don't think it matters".

jgm commented

A feature. See the spec under raw HTML blocks.

I see https://spec.commonmark.org/0.30/#example-148
"Unfortunate", but I guess there must be a reason to do it like that.

Thank you for your response 😊