Archive for the 'Markdown' Category

Updating NativeMarkKit for SwiftUI and iOS 14

I’ve pushed a small update to NativeMarkKit, my native Markdown rendering framework. It adds some SwiftUI wrappers that incorporate workarounds for the UIKit-SwiftUI interop bugs. It also fixes a bug introduced by iOS/tvOS 14 that prevented inline backgrounds from being rendered.


Introducing NativeMarkKit, native Markdown rendering

I’d like to announce the release of one of my side projects: NativeMarkKit. NativeMarkKit is a Swift package implementing the rendering of NativeMark. What’s NativeMark? Well, it’s a flavor of Markdown designed to be rendered by native iOS, macOS, or tvOS apps. i.e. it compiles down to NSAttributedString (mostly) instead of HTML and CSS. It’s basically CommonMark, but without the raw HTML tag support.

I often get mockups from designers who want to style text like they would on web. So they mix in bold, italics, links and other things within the copy. While that can be done natively, it’s a hassle, requiring manually building up NSAttributedStrings and concat-ing them together. NativeMarkKit allows me to have one localized Markdown string, and let the framework figure out how to render that down into a NSAttributedString. As a bonus, NativeMarkKit supports Dynamic Type and Dark Mode. I can also style the Markdown using whatever app-branded NS/UIColors I have in the app.