A Better iOS/MacOS Native Markdown Renderer — Proof of concept
One day this may be the best markdown UI that money can buy 🤞
I’ve been working on a better cross-platform markdown renderer using platform specific native text rendering technologies. Although I hope to support other rich text markup formats down the road like LaTeX Math.
Here are some screenshots of my work so far,
But what I think is especially cool is that this supports freakin Markdown tables with full text selection support!
Honestly I think the tables look better than anything you'd see in a browser and furthermore it kinda has that traditional ‘typeset’ look and feel (which I’m quite happy about considering it’s practically reimplemented in such system.)
Currently the proof of concept has been implemented in terms of AppKit but the core functionality is cross platform. I’ve even conformed that multi cursors work flawlessly in iOS (as far as TextKit 2 functionality is concerned).
Details
So to elaborate a little more, this is a fully native but custom text view implementation (does not use NSTextView/UITextView) for macOS and eventually iOS apps without using web views (since they break layout in complex view trees). Internally this is using TextKit 2 APIs (would not be possible otherwise), and for table layout this is using my own cross platform implementation of NSTextTable (NSTextTable is macOS only for some reason).
I now have basic full support for all GitHub flavored markdown block types. The only missing thing — as of this writing — is that tables and blockquotes don’t yet support displaying their syntax tokens for a more plain-text like feel.
Also while it’s not pretty, I thought this was interesting:
The above was an early example multi cursor text selection of tables that—notably— includes an empty column at the end, which I kinda like but the latest version on GitHub has this disabled to be more akin to the original source code. What I like about adding an empty column at the end is that I could make it easy to append new columns to the end of the table, or use this for quickly appending new rows where you just position the cursor at the end of a table row and press enter.
One thing that really surprised me is now “natural” text selection feels. E.g. in comparison have you ever seen a user land implementation of text selection in a browser that felt “right”?
Customizing text selection in any way in the browser (including overriding the menu) just feels clunky and usually it just annoys your users… So in comparison while my implementation isn’t perfect, it’s not terrible at the same time which was really surprising. Perhaps with a little more work it can feel as seamless as what you’d expect from a system implementation by Apple.
Again this can’t be understated. People are always like: companies don’t give a crap about native iOS/macOS support because everything you’d wanna do is already possible in a browser/web view and yet here’s an instance of something that’s just not trivial to do in a browser and when such does happen it never feels “right”. Especially overriding text selection is usually slow and clunky and annoying to end users, though practically every chatbot web app is doing so anyway… So perhaps they’ll just pay to license my software since I’m actually doing it the right way. :)
GitHub Project Links
Current Redesign (at the time of this writing it’s not yet ready for public consumption but I thought I’d leave it here for those low-level devs who want to get involved)