Shortcodes: openPattern '{{' doesn't work on linux (Arch linux), best alternative ? Possible fix ?
openPattern: {{ doesn't work on my machine, I get this error message from rollup:
44: {{ picture src={data.url} /}}
^
...
ParseError: Unexpected token
(arrow under the 's' of src).
So for now I go with %% as the openPattern operator. All operator including bracket seems to have the same result, no problem with closePattern set to }}.
Two questions about it:
- What is the best alternative according to you ?
- Do you think is something that can be fix in the future ? Thank's :)
Have you tried without the space? {{picture src={data.url} /}}
Also, the first place I'd look is actually at the shortcode library (https://github.com/Elderjs/shortcodes) and see if those tests pass and possibly write a failing test if they do.
To use {{{ for instance you'd need to use regex escaped chars. I believe this would be:\\{\\{\\{ in your elder.config.js.
Same result without the space and regex escaped as you described doesn't work either. I'll dig into this later.
Same problem for me. I found a workaround that works:
tempalte.Svelte
... @@picture src={data.myLogoUrl} /@@@ ...
elder.confis.js
... openPattern: '@@', closePattern: '@@@', ...
Also, you can use the helpers like this:
{@html helpers.shortcode( {name: 'shortcode_name', props: {} } ) }
Interesting, I might try that. Thanks !
That's currently interesting, because if I understand well, this helper return the shortcode.
So: openPattern + your shortcode + closePattern
And it works even if we have {{ as openPattern.. Hum.. :thinking:
Edit: in elderjs/shortcodes, there is already a test about that and it pass on my machine.
Given these informations, the issue probably come from the implementation.
Investigate mode activate :eyes: