saket / press

Cross-platform markdown editor written in Kotlin Multiplatform (work in progress)
1.87k stars 113 forks source link

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

Closed saket closed 4 years ago

saket commented 4 years ago

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

saket commented 4 years ago

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?

saket commented 4 years ago

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

hackertronix commented 4 years ago

I am unable to assign it to myself :(

saket commented 4 years ago

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

saket commented 4 years ago

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.

saket commented 4 years ago

Superseded by https://github.com/saket/press/issues/51