Render in the main editor view


I have been playing with a package for myself designed to promote comments in code by using markdown syntax.

Whilst this is ok, I would like to change the comments in the main view to the rendered markdown comment.

Can anyone provide pointers, preferably in Javascript to how to do this?