Hacker News new | ask | show | jobs
by kenferry 39 days ago
The native Apple libraries are terrific at rendering rich text, it’s one of their strongest assets.

The poster’s issues seem to be specifically because they want to use markdown as the backing. The native rich text backing for native Apple views is attributed strings. They could translate the markdown to attributed strings, but seems like they don’t want to.

1 comments

..where did you get that impression?

The web also requires you to convert to html. I don't see how this is different

I have this impression because I know the native controls are terrific at rich text, so for some reason that support isn't done in a way the author wants to use. The source code of the TextEdit app on Mac is actually published as an example project for the frameworks. Everything in there is provided by the native framework controls.

It would make sense, for example, if you wanted to allow editing of the rich text and have the markdown be directly accessible by the user. The conversion of markdown -> attributed strings -> markdown would not produce the same raw text, which is a problem if the user can directly edit or view the markdown. The user hitting cmd-B in the text view to make something bold might end up scrapping some explicit formatting they did to the raw markdown.

Markdown can contain arbitrary HTML. It only makes sense to use an HTML viewer for what is essentially a dialect of HTML, aka a browser engine.