kyle-n / HighlightedTextEditor

A SwiftUI view for dynamically highlighting user input
MIT License
726 stars 69 forks source link

Separate backing text from presented text #47

Closed niklassaers closed 3 years ago

niklassaers commented 3 years ago

Hi Kyle,
first of all, super cool project. I'm looking into using it instead of another rich text editor, and one thing that I'm running into is that the user sees the formatting codes. For my own part, that's cool, but most of my users don't want that. They want a text that is about the text, where some parts are bold, some are italic, and some parts are underlined.

Is there, or can we introduce, a difference between the presented text, and the backing text store? Having the backing in markdown like you demo is awesome, but for input I'd like to let the user select text, hit a "bold" button or keyboard shortcut, and present it in bold not including the markdown formatting codes for that.

kyle-n commented 3 years ago

Haha, I actually made HLTE because I was frustrated at other Markdown editors not showing the formatting codes.

Right now, no, this is not supported. Implementing it is theoretically possible, but would require a lot of work. It's not on my roadmap of potential features.

When I was looking for alternative Markdown editors last year, I think I found one that behaved like you describe. I cannot remember the name, unfortunately. Sorry I can't be more help.

niklassaers commented 3 years ago

Cool, thanks for making it clear. :-)