zola: Allow shortcodes in shortcode bodies
If a short-code with a body is used in the body of a short-code it’s {% end %}
is matched with the outer short-code. This prevents the use of nested short-codes with bodies.
Use Case
I’m trying to write reveal.js
presentations in Gutenberg currently and I have defined simple shortcodes for vertical slides, fragments, and notes:
<aside class="notes">
{{ body | safe | trim | markdown }}
</aside>
<section{%- if id %} id="{{id}}" {%- endif -%}
{%- if attributes -%}
{%- for attr in attributes %}{#
#} {{attr.attribute}}="{{attr.value}}"
{%- endfor -%}
{%- endif -%}>
{{ body | safe | markdown(inline=true) }}
</section>
<span class="fragment">
{{ body | safe | trim | markdown }}
</span>
This makes it easier to write slides like so:
+++
title = "Installation instructions"
+++
{% vertical_slide() %}
Main content
{% notes() %}
- notes on main content
{% end %}
{% end %}
{% vertical_slide() %}
Basement slide with extra content
{% notes() %}
- notes on basement content
{% end %}
{% end %}
Workaround
Of course I can just throw in html to work around this, but I find short-codes are more pleasant to work with, especially when I have more complicated things going on like figures with complex markup that I’ve created with short-codes showing up in vertical slides.
For example:
{% vertical_slide() %}
**Linux** (Ubuntu/Debian)
`sudo apt-get install git`
<figure class="toggle-figure">
<span class="toggle-figure__button"></span>
<img class="toggle-figure__figure" alt="`sudo apt-get install git`" src="img/gif/linux-install-git.gif"/>
</figure>
<aside class="notes">
- Linux typically comes with `git` installed
- `git` was created specifically to manage the Linux project
</aside>
{% end %}
However, this isn’t ideal since the list inside the aside is not rendered as markdown.
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 16
- Comments: 15 (1 by maintainers)
This is something that I too have been looking for in static site generators without success (I’m currently using Hugo). My use case is documentation, e.g.:
<div>
, itself containing header and body<div>
s.nginx.md
in the document tree, fetch its frontmatter title, embed the anchor in thehref
, but obscure it in the link text.<span>
with a file icon and become red (or throw an error at build time) if the file isn’t found.There are a lot of possibilities that allow one to write concise documentation. Having to use inline HTML or do manual validation is terrible for productivity, and any changes to recurring elements would have be reapplied in every document, instead of a single template file.
@Keats I will be more than willing to implement this once I am done with my current project.