Render contents in tooltip

Hello everybody,

I’m totally new to developing plugins for obsidian and just testing waters with creating a simple plugin that shows contents of certain note in a “tooltip” when hovering over a task, similar to how obsidian shows note preview on hover over the links. I can get contents of the file but when it shows the “tooltip” it shows source/edit mode version of the note, not the read/preview with all the plugins and whatnot applied. how do I make it show the read/preview instead?