getzola / zola

A fast static site generator in a single binary with everything built-in. https://www.getzola.org

Home Page:https://www.getzola.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Broken rendering when using shortcodes inside code blocks

knadh opened this issue · comments

Bug Report

Environment

OS: Fedora 40
Zola version: v0.12.2

Expected Behavior

A shortcode that renders content inside a code block (single or three backticks) should render the content correctly.

Current Behavior

Shortcodes that render content within code blocks render broken HTML with HTML-encoded <pre> tags.

Within single backticks:
image

Raw HTML:
<code>&lt;pre data-shortcode&gt;print("hello world")&lt;/pre&gt;</code>

Within three backticks:
image

Raw HTML:

<pre style="background-color:#1e1e1e;"><code><span style="color:#dcdcdc;">&lt;pre data-shortcode&gt;print(</span><span style="color:#d69d85;">"hello world"</span><span style="color:#dcdcdc;">)&lt;/pre&gt;
</span></code></pre>

Step to reproduce

Create a shortcode file with any arbitrary content: templates/shortcodes/test.html

print("hello world")

Invoke it in a .md content file.

```python
{{ test }}
```

or

`{{ test }}`

Zola version: v0.12.2

Is that a typo?

Whoa, I somehow brain-farted and downloaded v0.12.2 instead of the latest v0.19.2. This issue is not reproducible in v0.19.2. Thanks for pointing out!