Zola 0.15 .md shortcode stopped working

hi,
just updated to v0.15 (from 0.14.1) and my code.md shortcode broke.

{%- set code = load_data(path = path, format = "plain") -%}
'''{%- if syntax -%}{{ syntax }}{% endif %}
{{ code }}
'''

(the three ’ above are backticks in the real file)

i use it like this…

{{ code(path = "content/software/supercollider/pakt-februari/pakt29.scd", syntax = "supercollider") }}

the weird thing is that when i put two or more of these shortcodes in the same content file, the resulting code blockas are all fragmented and broken. i also get ||ZOLA_SC_PLACEHOLDER|| at the bottom of the page - one for each additional {{ code… }.

any ideas? i tried simplifying the .md shortcode but anything i put in there results in a broken output when two or more shortcode calls.

thanks,
_f

That’s the replacement text the shortcode parser inserts. I’ll add that as a test to figure out what’s happening. Can you paste an entire .md that fails?

sure, here’s a simple index.md that demonstrate the problem (macOS 10.14.6, rustc 1.57.0, zola 0.15.0)

+++

in_search_index = false

title = "ttest"

+++

ttest1

{{ code(path = "content/software/supercollider/pakt-februari/pakt29.scd", syntax = "supercollider") }}

ttest2

{{ code(path = "content/software/supercollider/pakt-februari/pakt29.scd", syntax = "supercollider") }}

templates/index.html is basically just… <section>{{ section.content | safe }}</section>

and templates/shortcodes/code.md is a file with only one line… 123

the resulting html is…

<section><p>ttest1</p>
<p>123</p>
<p>123HOLDER||</p>
</section>

so the ttest2 line disappeard and the HOLDER|| thing looks wrong.

Thanks i’ll have a look soon. It looks like a 0.15.1 will be needed!

That one was embarassing, can you try the next branch Next version by Keats · Pull Request #1682 · getzola/zola · GitHub ?

yes, now with the next branch it seems to work. thanks a lot.
also thanks for creating Zola. it’s great!

another small oddity that is also new in 0.15. (could be that this is a user error.)

if i in the test above change the name of the argument syntax to lang, the syntax highlighter fail with the warning: “Warning: Highlight language en not found in…

i.e.

{{ code(path = "content/software/supercollider/pakt-februari/pakt29.scd", lang = "supercollider") }}

and the shortcode .md file…

'''{%- if lang -%}{{ lang }}{% endif %}
123
'''

so somehow the lang argument is overwritten with the language of the website “en”.

yep, lang is a reserved parameter of Zola that is passed to every template to identify the current language. You would need to name yours something different.

1 Like