Z12.1 stray pre short-code tag

concerning the new 12.1 release (thanks!)

In my shortcodes folder I have this code.html file…

{%- set code = load_data(path = path) -%}
{{ code | safe }}

In .md files I can then render blocks of syntax-colorized code from different files in different languages like this…

```rust
{{ code(path = "content/software/nannou/spiral/src/main.rs") }}
```

that worked fine in Zola 11, but broke in Zola 12. Now with 12.1 it is kind of back to normal, except that there’s now a stray pre tag inserted in the beginning of my rendered block of code. The result can look like this…

<pre data-shortcode>use nannou::prelude::*;

fn main() {
    nannou::sketch(view).size(800, 600).run();
}

plus a closing pre tag in the end.
So, is this tag supposed to be there? Am I doing something strange?

That seems like a bug with the new code that was introduced to fix shortcodes, I didn’t have tests covering shortcodes in code blocks. I’ll fix it for the next release but in the meantime you can either:

  1. go back to 0.11 while it’s being fixed
  2. try to use Markdown rendering shortcodes: rename your shortcode template to have a .md extension and put the fenced code block in there as well (so add a lang parameter to your shortcode)

I think 2 might work unless Markdown tries to create more code block inside the code block.

Option 2 worked great!
Nice, didn’t know one could write Markdown shortcodes.
Thanks a lot.

It’s a new feature in 0.12!