0

I'm trying to build a markdown editor in macOS and I found this package: https://github.com/kyle-n/HighlightedTextEditor

However, the one thing I would like to extend is the possibility to have markdown characters removed.

E.g when typng **bold**, it should dynamically render the bold text but without the asterisks. I assume I need to use a NSLayoutManager but not sure how to proceed. I'm quite new to Swift development and I tried following along the Text kit guides on WWDC but it kinda flew over my head. Any pointers on how to start?

Just to clarify: it should work for user input, so it needs to work for TextField, not Text alone

I found another post Hide Markdown Characters with NSLayoutManager in Swift but I can't wrap my head around how to implement the glyphRange functionality

erikvm
  • 858
  • 10
  • 30
  • Does this help: https://stackoverflow.com/questions/66815962/using-markdown-text-in-textview-dynamic-text-editing-in-swift ? Alternatively, if that is an option, SwiftUI has Markdown built in. – koen Aug 06 '22 at 12:30
  • You can't use markdown together with TextField. I need to have the ui update as the user types. As far as I know, Markdown in SwiftUI is only for Text, not textfields.. – erikvm Aug 06 '22 at 12:47
  • Please [edit] your question to indicate this is for a TextField. – koen Aug 06 '22 at 13:40

0 Answers0