Reformat / Add a div and a class to the image out of kirbytext

How can i add and rewrite the syntax of an image inside the kirbytext. I want to add fancybox and an extra icon etc…

Where can i find the rules for kirbytext? specially the image things? Can i wrote all the new configuaration in config.php?

thanks for help

You can extend/overwrite Kirbytags in a plugin, see the docs:

The original code for the tags is here: