A fast, Kotlin-native Markdown parser

Overview

Krakdown

Krakdown is a markdown parser written in native Kotlin (no external dependencies). It is meant to be used either on the server side (running in a JVM), or to be cross-compiled into Javascript and run in a browser.

Project status

The project has a small portion of the common-mark specification covered (mostly around lists and blockquotes).

It is not heavily tested yet, and probably contains a large amount of bugs, and potential performance issues.

Structure

The parser is broken into two parts: a block parser and an inline parser. Both parsers work via chain of responsibility where rules are evaluated in order on the input.

The inline parser consists of a lexer and a parser. The lexer is fairly heavy, as it evaluates tokens based on current context (it performs look-behind).

Roadmap

Commonmark compatibility

Next steps here would involve adding the remaining common mark tests to the src/test/resources/commonmark.testspec specification file and then performing the necessary fixes in the parsers to get this project to 100% commonmark compatibility.

Streaming parsing

Once common mark compatibility is reached, the parser will be updated to support stream parsing, i.e. consume data from an input stream and produce a stream of parse nodes. This would, ideally, decrease the memory footprint of the parser, as it would ideally keep at most the necessary memory for processing a single block of text.

Performance

At present, the performance of the parser is not thoroughly measured. A test suite should be built to measure the performance of the parser.

Support for non-standard markdown extensions

Support for tables, todos, footnotes, definition lists, custom block quotes, table of contents, etc.

You might also like...
Multiplaform kotlin library for calculating text differences. Based on java-diff-utils, supports JVM, JS and native targets.

kotlin-multiplatform-diff This is a port of java-diff-utils to kotlin with multiplatform support. All credit for the implementation goes to original a

Native Kotlin library for time-based TOTP and HMAC-based HOTP one-time passwords

A kotlin implementation of HOTP (RFC-4226) and TOTP (RFC-6238). Supports validation and generation of 2-factor authentication codes, recovery codes and randomly secure secrets.

Android Utilities Library build in kotlin Provide user 100 of pre defined method to create advanced native android app.

Android Utilities Library build in kotlin Provide user 100 of pre defined method to create advanced native android app.

A Kotlin native Postgres driver for SqlDelight.

Module postgres-native-sqldelight A native Postgres driver for SqlDelight. Source code Install This package is uploaded to MavenCentral and supports m

A robust native library loader for Android.
A robust native library loader for Android.

ReLinker A robust native library loader for Android. More information can be found in our blog post Min SDK: 9 JavaDoc Overview The Android PackageMan

Routable, an in-app native URL router, for Android

Routable Routable is an in-app native URL router, for Android. Also available for iOS. Usage Set up your app's router and URLs: import com.usepropelle

SoLoader is a native code loader for Android.

SoLoader is a native code loader for Android. It takes care of unpacking your native libraries and recursively loads dependencies on platforms that don't support that out of the box.

React Native wrapper to bridge our iOS and Android SDK
React Native wrapper to bridge our iOS and Android SDK

React Native wrapper to bridge our iOS and Android SDK

Gitversion - A native console application to calculate a version based on git commits and tags

GitCommit A native console application to calculate a version based on git commi

Comments
  • Plans for further development?

    Plans for further development?

    Hey @nickhristov, this looks like a great project. Do you have any plans for continuing development on this?

    I'm trying to leverage Kotlin multiplatform for building a cross-platform markdown editor app. Although it's possible to use separate parsers for each platform, using a single parser for all platforms will make things so much simpler.

    I found a couple of other similar projects on Github, but your code feels the most readable of them all.

    opened by saket 3
Owner
Nick Hristov
Architect @ Turvo.
Nick Hristov
APK parser for Android

APK Parser Features Retrieve basic apk metas, such as title, icon, package name, version, etc. Parse and convert binary xml file to text Classes from

Jared Rummler 613 Dec 20, 2022
Apk parser for java

APK parser lib, for decoding binary XML files, getting APK meta info. Table of Contents Features Get APK-parser Usage 1. APK Info 2. Get Binary XML an

Hsiafan 1.1k Dec 18, 2022
Parser and Expression Evaluator for Logic Statements

LogicParser Parser and Expression Evaluator for Logic Statements: The steps behind the whole process of evaluating a given logic statement encompass:

Bărbuț-Dică Sami 1 Dec 8, 2021
🧹 Error correcting parser plugin

Tidyparse The main goal of this project is to speed up the process of learning a new language by suggesting ways to fix source code. Tidyparse expects

breandan 5 Dec 15, 2022
UE Capability parser used by smartphonecombo.it and cacombos.com

UE Capability Parser Warning Work In progress UE Capability parser used by smartphonecombo.it and cacombos.com $ java -jar uecapabilityparser.jar --he

Andrea Mennillo 4 Oct 16, 2022
Native solution for common React Native problem of focused views being covered by soft input view.

react-native-avoid-softinput Native solution for common React Native problem of focused views being covered by soft input view. It is solved by listen

Mateusz Mędrek 312 Jan 2, 2023
A lightning fast, transactional, file-based FIFO for Android and Java.

Tape by Square, Inc. Tape is a collection of queue-related classes for Android and Java. QueueFile is a lightning-fast, transactional, file-based FIFO

Square 2.4k Dec 30, 2022
A library for fast and safe delivery of parameters for Activities and Fragments.

MorbidMask - 吸血面具 Read this in other languages: 中文, English, Change Log A library for fast and safe delivery of parameters for Activities and Fragment

Season 67 Mar 29, 2022
Hornox is a fast BSON serializer, deserializer and node extractor for the JVM.

Hornox is a fast, simple-stupid BSON serializer, deserializer and node extractor for the JVM. Features Full implementation of the BSON Specification w

Txture 1 May 12, 2022
Fuzzy string matching for Kotlin (JVM, native, JS, Web Assembly) - port of Fuzzy Wuzzy Python lib

FuzzyWuzzy-Kotlin Fuzzy string matching for Kotlin (JVM, iOS) - fork of the Java fork of of Fuzzy Wuzzy Python lib. For use in on JVM, Android, or Kot

WillowTree, LLC 54 Nov 8, 2022