Can you share a little more about what you’re trying to achieve? There are a few different APIs that allow you to modify post content when it renders. The most common one would be api.decorateCookedElement
The problem with this method, is that it triggers multiple cooked objects at once and thus preferes an id (to avoid memory leaks), which is not something I need. What would worked for me, is if only one event was triggered after all elements are cooked. I have an idea on how it could be clutched but is there a proper way of doing it using Discourse API?
The decorateCookedElement api will be triggered once for each rendered post. The callback will be passed the DOM element containing the post content. The idea is that you only modify the element you’ve been passed, and not anything else on the page.
But since you want to make modifications to the metadata around the post content, decorateCookedElement probably isn’t the right option.
Then the best thing is probably to look at how the addPosterIcon API is implemented: