Kirbytext/Plugin not rendering as expected

I am not sure what has changed for this to happen, it was working and then stopped working. Can someone point me in the right direction please?

The gallery plugin that is included in the default starterkit no longer renders images and is instead just rendering the html as text. Take a look at the bellow and imagine this as just text on a blog page instead of actually being converted to HTML and rendering the list element with images.

Both extremely arid and arid lands are considered to be deserts while semiarid lands are generally referred to as steppes when they are grasslands.

<ul class="photos" data-count="5">
    <a href="">
        <img src="//localhost:3000/cms-dev/media/pages/albums/desert/2634845693-1554996104/area-51.jpg" alt="Night sky over the desert" />

Polar deserts such as McMurdo Dry Valleys remain ice-free because of the dry katabatic winds that flow downhill from the surrounding mountains.

Is this a WAMP (PHP, apache) configuration problem or is it something else I may have messed around with inside Kirby?

Hm, that doesn’t look like the HTML provided in the gallery snippet? Have you changed anything in the plugin itself?


Kirby::plugin('starterkit/gallery', [
    'hooks' => [
        'kirbytags:after' => function ($text, $data, $options) {

            if ($page = $data['parent']->gallery()->toPage()) {
                $gallery = snippet('gallery', ['gallery' => $page], true);
            } else {
                $gallery = '';

            return str_replace('{{ gallery }}', $gallery, $text);

Plugin stays the same, not changed there.

Yes I’ve changed the HTML of the render.

<section class="gallery">

    <ul class="photos" <?= attr(['data-count' => $gallery->images()->count()]) ?>>
        <?php foreach ($gallery->images() as $image): ?>
                <a href="<?= $image->link()->or($image->url()) ?>">
                        <img src="<?= $image->url() ?>" alt="<?= $image->alt() ?>" />
        <?php endforeach ?>
    <!-- END .photos -->

<!-- END .gallery -->

It’s the indents. Either remove them or indent only two spaces or apply the fix suggested here

:walking_woman: goes searching for the link…

… comes back with the link: How to render a snippet inside a custom KirbyTag without `<pre>` tags appearing?

Hmm, 2 space indents make it hard to read. Hence why I always use 4 spaces. For a product to inforce something like this is stupid, indents should be client defined so people can work comfortably - however it’s not actually the indents that breaks this.

It’s the new blank lines that break it.

Thank you for the help as always @texnixe, and pointing me in the right direction.