getzola/zola

Multi-line shortcodes end lists too early

オープン

#2,618 opened on 2024/08/19

 (11 件のコメント) (0 件のリアクション) (1 人の担当者)Rust (1,046 件のフォーク)batch import
buggood first issuehelp wanted

Repository metrics

Stars
 (15,349 個のスター)
PR merge metrics
 (平均マージ 48d 17h) (30d で 4 merged PRs)

説明

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.

コントリビューターガイド