xavdid / obsidian-golinks

Turn go/links into clickable elements in Obsidian
MIT License
11 stars 0 forks source link

Add support for live preview #1

Open ProfessionalStoic opened 2 years ago

ProfessionalStoic commented 2 years ago

It would be useful to also show go/ hyperlinks in live preview mode, rather than just in view mode.

This would be similar to how hyperlinks (starting with http://) become clickable in live preview mode by default in obsidian today.

xavdid commented 2 years ago

Oh sure! I'll look into it. I'm not sure how rendering in live mode differs, but it shouldn't be too hard to add.

xavdid commented 2 years ago

I spent some time on this this weekend and couldn't figure out how to do it.

To modify live preview, we'd need a CodeMirror plugin, which is pretty complex (relative to obsidian plugins, which I already found pretty complex).

I have a copy of this demo plugin running, but I got stumped on how to adapt the enter(node) { ... } callback to be able to read the actual text of the node and run regex over it.

If you have some time and would like to fuss with it, I'd be happy to merge a contribution!

Seems like other obsidian developers have also found this hard, see: https://github.com/blacksmithgu/obsidian-dataview/issues/1058