Add custom button to rendered code

Hi,
I would like to be able to add a custom button to my code output so for example if you have this

and then you did ```javascript run

it would render a button at the bottom of the code panel

What would be the best way to do this?