shortcode->getHandlers()->add('scrolly-section', function (ShortcodeInterface $sc) { $plugin = $this->grav['plugins']->getPlugin('story-blocks'); $page = $plugin ? $plugin->getCurrentPage() : null; $imageName = htmlspecialchars($sc->getParameter('image', ''), ENT_QUOTES); $alt = htmlspecialchars($sc->getParameter('alt', ''), ENT_QUOTES); $caption = htmlspecialchars($sc->getParameter('caption', ''), ENT_QUOTES); $content = $sc->getContent(); // ShortcodeCore renders inner Markdown to HTML; trusted author content $imageUrl = ($page && $imageName) ? $page->url() . '/' . $imageName : $imageName; $captionHtml = $caption ? '

' . $caption . '

' : ''; return <<
{$content}
HTML; }); } }