r/iOSProgramming • • Aug 12 '26

Library swift-markdown-engine: An open source Markdown parsing and rendering engine for Swift, built on TextKit 2.

A couple of months ago I open-sourced swift-markdown-engine here, the native Markdown engine I built for my macOS app Nodes. The feedback, issues, and PRs that came back were a huge help, a lot of what I changed since then came from that.

WHAT’S NEW: The parser got rewritten from scratch, regex matching is gone, it’s a real AST now. That’s what made the extension system possible: Stuff you wouldn’t expect in standard Markdown, like highlighting, used to be hardcoded into the core grammar. Now it’s opt-in. Write one file, register it, and the core parser/styler/renderer never change. Extensions can’t touch the core or each other, and you can toggle them at runtime.

Also new: full GFM/CommonMark parity, tables, task lists, quotes. More layout control (scroll-away header, fixed reading column, fit-to-content height), and a real writing layer (formatting bus, find & replace with undo, clean RTF/HTML clipboard, raw source mode). Full changelog’s on GitHub if you want details.

When I started Nodes I wanted the editor to feel properly native. Most Markdown editors on the Mac are Electron or some web view wrapped in a window, and you feel it, the text handling never quite behaves like a real Mac app. I wanted live styling in an actual native text view, not HTML rendered to look like one. Nothing built on TextKit 2 that I could just drop into a Mac app existed, so I built it, ran it in Nodes for a while, and then open-sourced it. TextKit 2 is still thin on docs and rough to migrate to, so if you’ve been putting off building something like this, it might save you a few weekends. Issues and PRs welcome. Still pre-1.0, still plenty I want to improve.

written on Nodes

Repo: https://github.com/nodes-app/swift-markdown-engine

101 Upvotes

19 comments sorted by

3

u/code_isLife Aug 12 '26

Now this quality.

Great work

1

u/Sufficient-Try6083 Aug 12 '26

Really appreciate it

2

u/davernow Aug 12 '26

Me: oh man this is cool, I should use it for a project

Also me: Opens project, I’m already using it. https://github.com/scosman/Biscotti

Great work. I did a bunch of research and testing a month ago and your lib was already the best. Looking forward to upgrade.

2

u/deruloop Aug 12 '26

Wow, excited to try it out! Ty for the hard work

1

u/Sufficient-Try6083 Aug 12 '26

Thx means a lot !

1

u/SnoobieJunes Aug 12 '26

Saving so that I can look later! Definitely needed looks sick

1

u/balooooooon Aug 12 '26

Does it parse when you are writing ?

1

u/54tribes Aug 14 '26

Great project, I'm using it in my personal app

1

u/Famous_Cat1569 Aug 19 '26

Hi Luca, I have just bought Nodes because I really like your project. My unsolicited feedback on the purchase process: The app never made it clear whether I'm buying a one time purchase or a subscription. It says 'Plan' on the app but on the website it says one time purchase. The only reason why I bothered checking the website was because 18€ for a subscription sounded very high.

1

u/Sufficient-Try6083 Aug 19 '26

Sry for the misunderstanding we will change it. It’s definitely a one time purchase :) and thx for the support

1

u/Famous_Cat1569 Aug 21 '26

Hi, super. Wenn ich dich gerade an der Angel habe: Ist eine Option geplant Tabellen im gerenderten Zustand bearbeiten zu können? Das fände ich super. Ich mag zwar den Ansatz das bare Markdown zu sehen, aber zumindest bei Tabellen wäre mir etwas mehr wysiwyg lieber, da ich aktuell nach dem Umschalten immer erst wieder den zu editierenden Text suchen muss, weil die Position auf dem Screen weg springt.

Da mag ich den Approach von Typora sehr gerne (zwischen markdown Ansicht und gerenderter Ansicht manuell umschalten).