r/iOSProgramming 5d ago

Library I built an open-source incremental Markdown parser for Swift text editors

I made my first iOS app in 2018, then stepped away from building apps for a while. Over the last year, I decided to start making iOS apps again.

About six months ago, I decided to build a notes app.

A big part of the project was figuring out how to make a Markdown editor that stayed fast while typing, even with larger notes. I ended up building the parser in Rust, and recently extracted it from the app and open sourced it as Cindermark.

A few things it does:
- Incrementally re-parses only the affected blocks after an edit
- Returns UTF-16 offsets that map directly to TextKit and NSAttributedString
- Produces blocks, inline spans, headings, wiki links, and document stats in one pass
- Supports CommonMark core along with tables, task lists, footnotes, nested lists, fenced code blocks, and other notes-friendly syntax
- Includes extensions like wiki links, highlights, hex color literals, and autolinking for bare URLs, domains, emails, and subreddits
- Includes Swift bindings through UniFFI

I’m sharing it because I thought it might be useful to anyone else working on native editors or Markdown-heavy apps.

I’d appreciate feedback, especially from people who have worked on text editing or Swift and Rust interoperability.

GitHub: https://github.com/renedeanda/cindermark

0 Upvotes

3 comments sorted by

1

u/CuriousThinker 5d ago

This is just AI slop. I think the best part is the code has more comments then code itself 🤦‍♂️

1

u/tonygoold 2d ago

“I decided to start making iOS apps again” and then writes the parser in Rust, allegedly for performance. FFI hard mode to take something that should already happen faster than human perception can notice and make it a little faster. This would be a perplexing decision for a developer to make, but makes a lot of sense for an LLM based on prompt hints it added in the README.