I got images working in the #Markdown editor I'm building 🚀
In the old Markdown rendering engine I also had images working, but this new version is a completely new implementation - none of the code is like before.
I decided to scratch my own implementation because even though my Markdown rendering engine was working as expected, I had some serious problems getting `NSTextView` and `TextKit2` to behave the way I wanted. For example, I was fighting a bug where it would apply the same styling to the last empty line as the text before it. Then I tried switching to `STTextView`, which did solve the bug, but had its own problem… It would crash the entire app as it caused an infinite loop bug because it was fighting #SwiftUI over the correct height of the textview. Therefore, the app kept recalculating the height which would eventually lead to a crash.
Link to the Markdown rendering engine I am using:
This new engine solves the empty-line-bug I mentioned above.
In the old Markdown rendering engine I also had images working, but this new version is a completely new implementation - none of the code is like before.
I decided to scratch my own implementation because even though my Markdown rendering engine was working as expected, I had some serious problems getting `NSTextView` and `TextKit2` to behave the way I wanted. For example, I was fighting a bug where it would apply the same styling to the last empty line as the text before it. Then I tried switching to `STTextView`, which did solve the bug, but had its own problem… It would crash the entire app as it caused an infinite loop bug because it was fighting #SwiftUI over the correct height of the textview. Therefore, the app kept recalculating the height which would eventually lead to a crash.
Link to the Markdown rendering engine I am using:
GitHub
GitHub - nodes-app/swift-markdown-engine: A native AppKit Markdown editor for macOS, built on TextKit 2 and bridged to SwiftUI.
A native AppKit Markdown editor for macOS, built on TextKit 2 and bridged to SwiftUI. - nodes-app/swift-markdown-engine



