How do I configure it like the Obsidian Editor?

In Obsidian’s editor, if you type # as the first character of a line and press space, it switches to the h1 tag and the # character disappears. If you hover over the character, it reverts back to its original size and the # character appears, allowing you to cancel the command.
How can we achieve this effect?

Also, links in Obsidian are written in double brackets, so what would it take to write some custom events like links?

Thanks for reading!

I’m not 100% sure about how it is implemented in Obsidian but the effect where markup is hidden when the cursor is not inside the element can be done by hiding markup using Decoration.replace() and using the selection range in a transaction or using a transaction filter to determine whether the cursor is inside the element.

1 Like