This is an example of plugin that modifies post cooking:
https://github.com/discourse/discourse/blob/master/plugins/poll/assets/javascripts/lib/discourse-markdown/poll.js.es6