ralphpina / MarkdownParser

Kotlin Multiplatform Markdown parser with support for bold, underline, italics, and hyperlinks.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MarkdownParser

This is a simple POC to parse a subset of markdown and render it in Android and iOS.

Supported Markdown Styles

This POC tries to handle the following markdown styles:

  • bold: **bold**
  • underline: __underline__
  • italic: _italic_
  • hyperlink: [link text](http://google.com)

Shared

  • MarkdownParser.kt: exposes a parse() method that returns the copy and a list of entities.

Android

iOS

Example

Thus, the following copy:

val markdown = "Some text is **bold**. While some text is _italic_. Other is __underlined__. Lastly we have [link](http://google.com)."

Used like so in Android:

val textView = findViewById<TextView>(R.id.text_view)
val button = findViewById<Button>(R.id.button)
textView.renderMarkdown(markdown)
button.renderMarkdown(markdown)

Is rendered like so: screenshot

About

Kotlin Multiplatform Markdown parser with support for bold, underline, italics, and hyperlinks.

License:MIT License


Languages

Language:Kotlin 63.8%Language:Swift 36.2%