Skip to content

Fenced code block absorbing a blank line doesn't propagate the blank to the enclosing list's tight/loose state (other absorbing leaves do) #610

@numist

Description

@numist

Hello! Back again with a sibling of #608.

When a fenced code block (``` or ~~~) is open and absorbs a blank line as content, and the fence is then terminated by container collapse (rather than by an explicit closing fence), cmark leaves the enclosing list marked tight="true".

Input:

- - ```

  b

Expected:

<ul>
<li>
<ul>
<li>
<pre><code>
</code></pre>
</li>
</ul>
<p>b</p>
</li>
</ul>

Actual:

<ul>
<li>
<ul>
<li>
<pre><code>
</code></pre>
</li>
</ul>
b</li>
</ul>

AST:

<list type="bullet" tight="true">
  <item>
    <list type="bullet" tight="true">
      <item>
        <code_block xml:space="preserve">
</code_block>
      </item>
    </list>
    <paragraph>
      <text xml:space="preserve">b</text>
    </paragraph>
  </item>
</list>

Among the seven multi-line block constructs that absorb blanks (indented code, fenced code, HTML types 1, 2, 3, 4, 5), only fenced code is affected. The other six already update the list's looseness signal correctly when they absorb a blank.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions