zola icon indicating copy to clipboard operation
zola copied to clipboard

Multi-line shortcodes end lists too early

Open cpg314 opened this issue 6 months ago • 5 comments

Bug Report

I think this is identical to #1355, but given that issue is 3 years old, I am reopening an issue at @Keats 's request.

In summary, shortcodes that span multiple lines will result in lists closing too early and generating invalid HTML.

Environment

Zola version: 0.19.2 (1aa21e0d95a2a7a2ed98bdc9d06f96db82ac66b2)

Step to reproduce

content/_index.md

+++
template = "index.html"
+++

Test

- A
  {{image()}}
- B
- C

template/index.html

{{ section.content | safe }}

template/shortcodes/image.md

<div>
</div>

Expected Behavior

If the shortcode is put on a single line, then the generated code is correct:

<p>Test</p>
<ul>
<li>
<p>A</p>
<div> </div>
</li>
<li>
<p>B</p>
</li>
<li>
<p>C</p>
</li>
</ul>

Current Behavior

The generated code is:

<p>Test</p>
<ul>
<li>A<div>
</li>
</ul>
</div>
<ul>
<li>B</li>
<li>C</li>
</ul>

Note the </ul> closing too early.

cpg314 avatar Aug 19 '24 11:08 cpg314