- elder.js self closing shortcodes look like this:
{{foo bar="true"/}}
. Note the/
at the end is for Elder.js to parse both self closing and content wrapping shortcodes. - this clashes with other shortcode systems, eg. dev.to, which uses shortcodes that look like this:
{% youtube abc123 %}
- in elder.config.js you can customize the start and end shortcode:
{%foo bar="true"/%}
- however that
/
there is non negotiable. - this is why you need to customize the shortcode syntax
the strategy is, if you use remark
to process the text, to write a custom remark plugin to replace specifically this %}
ending code of the dev.to shortcode to what Elder.js expects
the plugin source follows below
real life usage https://github.com/sw-yx/swyxdotio/blob/2435aeb705f0c9c1e836c8a0f1159f922ee12769/src/plugins/elderjs-plugin-markdown/index.js#L39