Extending markdown parser

I need to have all html headlines on text on a webpage to have distinct IDs – Is it possible to rewrite the markdown parsing in a plugin in order to achieve this:

## Headline


<h2 id="headline">Headline</h2>

or do I need to use a custom kirbytag?

If you can’t rely on unique headlines, you could add a unique hash…

wow great, couldn’t find this cookbook page when i was searching for it earlier. thanks a lot!