It took me an embarrassingly long time to figure this out even after reading the thread. So I’ll share my lessons to potentially save others time.
If you started with PlainKit, you will NOT have lightbox included. Here’s how to add it:
Copy the following files from StarterKit:
/assets/css/lightbox.css
/assets/js/lightbox.js files
/assets/index.js file
Update /site/snippets/header.php to reference lightbox.css.
Update /site/snippets/footer.php to reference lightbox.js & index.js
(note: the JS will not work if placed in the header snippet).
From this point on, any <a> tag with the “data-lightbox” label that wraps an <img> will trigger lightbox. Now the trick is how to add the label to the HTML created by the KirbyText Image tag.
This is where a custom plugin comes into play:
Create a /site/plugins/custom-tags/ folder.
Copy the code that Brighurst shared above.
Save the code in a new index.php file within the “custom-tags” folder.