Hi I'm starting to use SilverBullet to edit my Zola website. I successfully added support for inline shortcodes, but when I tried to implement block ones, I couldn't because the regex seems to be applied line by line.
Do you know if it's possible in any way without touching the source code?
Here's the syntax definition, the endMarker regex should support nested shortcodes 3 level deep (if applied after the startMarker is consumed):
syntax.define {
name = "ZolaShortcodeBlock",
startMarker = "{%\\s*(?!end\\s*%)[^%]+%}",
endMarker = "(?:(?!{%)[\\s\\S])*(?:{%\\s*(?!end\\s*%)[^%]+%}(?:(?!{%)[\\s\\S])*(?:{%\\s*(?!end\\s*%)[^%]+%}(?:(?!{%)[\\s\\S])*(?:{%\\s*(?!end\\s*%)[^%]+%}(?:(?!{%)[\\s\\S])*{%\\s*end\\s*%}(?:(?!{%)[\\s\\S])*)*{%\\s*end\\s*%}(?:(?!{%)[\\s\\S])*)*{%\\s*end\\s*%}(?:(?!{%)[\\s\\S])*)*({%\\s*end\\s*%})",
mode = "block",
startMarkerClass = "sb-zola-shortcode-marker",
--bodyClass = "",
endMarkerClass = "sb-zola-shortcode-marker",
--renderClass = "",
renderWidget = function(body, pageName)
return widget.html(dom.i { body })
end,
renderHtml = function(body, pageName)
return dom.i { body }
end
}