saket / press

Cross-platform markdown editor written in Kotlin Multiplatform (work in progress)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Explore C interop with Kotlin/Native for sharing a common markdown parser

saket opened this issue · comments

Press currently delegates parsing of markdown to platforms using expect/actual, but managing the expected class signature of parsed nodes is a pain right now. The K/N community is new so there isn't any markdown parser written in kotlin, but there are sufficient libraries written in C that Press can leverage through C interop with K/N: https://kotlinlang.org/docs/reference/native/c_interop.html

We could use cmark: https://github.com/commonmark/cmark

Assigning this to @hackertronix who's working on adding bindings for cmark.

@hackertronix I've added some basic tests on saket/apr26/markdown-parser-test to help you test your bindings.

Update: Huh, I can't assign people randomly to an issue. That probably makes sense. @hackertronix wanna assign this yourself?

Actually, let me just disable those tests and merge them to master.

I am unable to assign it to myself :(

Looks like someone has to comment before they can be assigned. Done!

Turns out cinterop can only generate bindings for kotlin/native. We'll still have to use JNI for Android which sucks. I filed a feature request to support generation of bindings for all platforms but don't think that's going to happen anytime soon.

Superseded by #51