-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Asynchronous shortcode breaks macros #118
Comments
Hi, unfortunately this is due to a limitation of the templating language itself: https://mozilla.github.io/nunjucks/templating.html#macro.
Since the icon shortcode is asynchronous, you cannot use it in macros. |
Though, I could look into providing a synchronous version of the shortcode... |
Oh. I did not realise it was asynchronous… So, I guess the Lucide shortcut is synchronous (the Lucide plugin is here). Is it possible to override your Icons plugin to make it synchronous? Oh, I see your second comment now… Can I help? I'm new to Eleventy but not bad in JS, I could try to understand. |
The difference is that the Lucide plugin statically imports the icon data, whereas this plugin uses the filesystem as the source - meaning we read files for the SVG data, asynchronously. I think I should look into providing a more customizable approach to "sources" - maybe I provide a |
Thanks for changing the title, it was a bit aggressive, I'm sorry. Just asking, why did you choose the asynchronous API, what's the advantages here? |
It's faster in some places because I can queue a bunch of file system reads, like for many icons at once, without having to wait for the previous one to complete. Or at least that's my understanding 😅 - I've never been super confident with sync/async work. I could probably add a sync version of the shortcode though as I was saying earlier, I don't think it would be super difficult. |
Hello,
I wanted to add an icon in a macro, and it seems to fail silently. No error in the console, and the html is truncated just before the icon, the macro is returned and displayed as is. In my case, breaking the html, since there is no closing tag…
My macro:
This outputs:
and stops. The rest of the template, after the macro, is displayed.
Note: I installed the Lucide Icons Plugin, to test if the problem was only the plugin, or shortcodes in macros, or any other thing. It works with the
{% lucide "triangle-alert" %}
provided by this plugin.Do you need more information, what can I do to help?
Thanks in advance.
The text was updated successfully, but these errors were encountered: