How to show markup around mark, when some event happened?

Hi guys! How to show markup (like markdown **test**) around mark, when some event (focus or mouseclick) happened? And how to restore markup on other event? Thank you in advance!

That’s not something the editor does, out of the box, but it should be able to write a plugin that tracks whether markup should be shown and uses widget decorations to show it.