Skip to content

Multi-line shortcodes end lists too early #2618

Open
@cpg314

Description

@cpg314

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 (1aa21e0)

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.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions