It might be a good idea to simply start by making a #WYSIWYG editor that writes and reads #Markdown files, but without the show/hide functionality of the Markdown syntax in 'live-preview' mode. Instead, I have now made an editor that only shows the rendered Markdown using `swift-markdown` package. I will also have a 'source mode' (this mode should show the raw Markdown without any formatting). Building an #Obsidian-style live-preview editor is so damn difficult. My current hack is to render the Markdown syntax at a font size of 0.01, which makes it look invisible. That works visually, but it breaks keyboard navigation, because the cursor still has to step through those hidden characters. For example, if I have **bold**, the two invisible asterisks (**) on each side are still in the text buffer, so arrow-key movement feels awkward as the caret gets stuck on them. This project is frustrating but I can't give up! I want this to work out ๐Ÿ˜‚ #dev
Frederik Handberg's avatar Frederik Handberg
I moved away from building my own #Markdown parser. Now I am trying to use the package called `swift-markdown`. It's certainly more convenient because it takes care of all the edge-cases. Now I just need to think about how I am going to hide and show the Markdown syntax when selecting some text with styling applied. I tried cheating a bit by making the syntax a size of 1, so that the characters are so small they become invisible. This worked, but if having double or triple asterisks (** or ***), then it will obviously create more spacing when hidden, because they are still there, just a very small size. I can definitely understand why there are so few editors that support live-preview the way #Obsidian does it... #dev
View quoted note →

Replies (1)

โ†‘