getzola/zola

Multi-line shortcodes end lists too early

Open

#2618 aperta il 19 ago 2024

Vedi su GitHub
 (11 commenti) (0 reazioni) (1 assegnatario)Rust (1046 fork)batch import
buggood first issuehelp wanted

Metriche repository

Star
 (15.349 star)
Metriche merge PR
 (Merge medio 48g 17h) (4 PR mergiate in 30 g)

Descrizione

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.

Guida contributor