feat: add inline_svg shortcode

This commit is contained in:
st1020 2025-07-20 16:10:11 +08:00
parent b869da36fb
commit 4bfc2728dc
23 changed files with 198 additions and 115 deletions

View file

@ -0,0 +1,10 @@
{% set img = body | trim_start_matches(pat="![") | trim_end_matches(pat=")") | split(pat="](") %}<!---->
{% set alt = img | first() %}<!---->
{% set src = img | last() %}<!---->
{% set ignore_names = ["inline svg", "inline-svg", "inline_svg"] %}
<figure class="inline-svg">
{{ load_data(path="@" ~ page.path ~ src) | safe}}<!---->
{% if alt and not ignore_names is containing(alt | lower) %}
<figcaption>{{ alt }}</figcaption>
{% endif %}
</figure>