Disabling Markdown processing within shortcodes? #3643
Answered
by
wescowley
internettalk
asked this question in
Q&A
Replies: 1 comment 2 replies
-
I'm still very new to Eleventy, but the first thing I'd try, if you haven't
done so, would be to replace the {% and %} tags with {%- and -%},
which will strip whitespace. That has worked for me in some cases, though
you may need to play with combinations (like {% ... -%}) to get the effect
you want.
…On Sun, Feb 2, 2025 at 5:10 PM internettalk ***@***.***> wrote:
I'm trying to implement a shortcode (here is what I'm copying
<https://www.bash.lk/posts/tech/1-elventy-image-gallery/>) to an instance
of https://github.com/11ty/eleventy-base-blog, but I'm stumbling into
"random" <p> and <br> tags being inserted, unless I remove all spacing
within the shortcode itself (which, I can do, but I'd rather not).
i.e.
{% gallery "gallery1" %}
{% galleryImage "./gallery-1-1.png", "" %}
{% galleryImage "./gallery-1-2.png", "" %}
{% galleryImage "./gallery-1-3.png", "" %}
{% galleryImage "./gallery-1-4.png", "" %}
{% galleryImage "./gallery-1-5.png", "" %}
{% endgallery %}
->
<div class="gallery" id="gallery-gallery1"><p></p>
<p><a href="/gen/bz2oQ4VKz8-609.jpeg" data-pswp-width="609" data-pswp-height="1237" target="_blank"> <img src="/gen/bz2oQ4VKz8-192.jpeg" alt="" title="" style=""> </a><br>
<a href="/gen/6aLGz6bKKC-601.jpeg" data-pswp-width="601" data-pswp-height="1240" target="_blank"> <img src="/gen/6aLGz6bKKC-192.jpeg" alt="" title="" style=""> </a><br>
<a href="/gen/nM1Z2hGhdA-590.jpeg" data-pswp-width="590" data-pswp-height="1132" target="_blank"> <img src="/gen/nM1Z2hGhdA-192.jpeg" alt="" title="" style=""> </a><br>
<a href="/gen/iDDNbutOzh-598.jpeg" data-pswp-width="598" data-pswp-height="842" target="_blank"> <img src="/gen/iDDNbutOzh-192.jpeg" alt="" title="" style=""> </a><br>
<a href="/gen/XIDN6Xw_vl-595.jpeg" data-pswp-width="595" data-pswp-height="981" target="_blank"> <img src="/gen/XIDN6Xw_vl-192.jpeg" alt=""> </a></p>
<p></p></div>
When I'd much rather it be
<div class="gallery" id="gallery-gallery1">
<a href="/gen/bz2oQ4VKz8-609.jpeg" data-pswp-width="609" data-pswp-height="1237" target="_blank"> <img src="/gen/bz2oQ4VKz8-192.jpeg" alt="" title="" style=""> </a>
<a href="/gen/6aLGz6bKKC-601.jpeg" data-pswp-width="601" data-pswp-height="1240" target="_blank"> <img src="/gen/6aLGz6bKKC-192.jpeg" alt="" title="" style=""> </a>
<a href="/gen/nM1Z2hGhdA-590.jpeg" data-pswp-width="590" data-pswp-height="1132" target="_blank"> <img src="/gen/nM1Z2hGhdA-192.jpeg" alt="" title="" style=""> </a>
<a href="/gen/iDDNbutOzh-598.jpeg" data-pswp-width="598" data-pswp-height="842" target="_blank"> <img src="/gen/iDDNbutOzh-192.jpeg" alt="" title="" style=""> </a>
<a href="/gen/XIDN6Xw_vl-595.jpeg" data-pswp-width="595" data-pswp-height="981" target="_blank"> <img src="/gen/XIDN6Xw_vl-192.jpeg" alt=""> </a>
</div>
*Technical details:*
- 11ty 3.0.0,
- Based off of https://github.com/11ty/eleventy-base-blog,
—
Reply to this email directly, view it on GitHub
<#3643>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APQUR2B57J4E4FBAGDQ6ATT2N2JVZAVCNFSM6AAAAABWK2MIDCVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZXHEYDMMZZGE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
Wes Cowley
***@***.*** / www.wordsbywes.ink
|
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
internettalk
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to implement a shortcode (here is what I'm copying) to an instance of https://github.com/11ty/eleventy-base-blog, but I'm stumbling into "random"
<p>
and<br>
tags being inserted, unless I remove all spacing within the shortcode itself (which, I can do, but I'd rather not).i.e.
->
When I'd much rather it be
I know I can simply put all of the shortcodes on the same line... but that's an ergonomics nightmare, and I'd like to avoid that.
Technical details:
Beta Was this translation helpful? Give feedback.
All reactions