Setting an "a href" parameter inside Kirbys image tag

Hello everyone,
I am relatively new to Kirby and would like to use it for my first small project. For this I use the Thinking 3 theme which I have adapted to my needs.

Thinking uses Lity as a lightbox, so now my question is, how do I implement this into a Kirby Text image tag?
According to the documentation I can set some values like a, alt, link, text, etc but not just a parameter in the a tag (data-lity)
What would be the most sensible way to implement this, writing a plugin?

Thanks
Oliver

Your best bet is probably to override the image tag: https://getkirby.com/docs/cookbook/extensions/extending-kirbytags

As an alternative you could create a custom tag, but if you want the behavior for all images, it’s probably best to go for option one.

Instead of the preg_replace stuff in the cookbook example, for other types of changes if makes sense to make a copy of the original tag and change the bits you want to adapt.

Thank you very much,
I think custom tag seems to be the right solution, I don’t want to apply it globally to all images.