File tree Expand file tree Collapse file tree 5 files changed +39
-0
lines changed
src/main/kotlin/playground Expand file tree Collapse file tree 5 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ allprojects {
1818 maven(" https://dl.bintray.com/kotlin/kotlin-eap/" )
1919 maven(" https://kotlin.bintray.com/kotlinx/" )
2020 maven(" https://dl.bintray.com/kodein-framework/Kodein-DB" ) // TODO: Remove when Kodein DB exits beta
21+ maven(" https://dl.bintray.com/jetbrains/markdown" )
2122 }
2223
2324 tasks.withType<KotlinCompile > {
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ dependencies {
4646 implementation(" org.jetbrains.exposed:exposed-jdbc:_" )
4747 implementation(" org.jetbrains.kotlin:kotlin-reflect:_" )
4848 implementation(" org.jetbrains.kotlinx:kotlinx-datetime:_" )
49+ implementation(" org.jetbrains:markdown-jvm:_" )
4950 implementation(" org.kodein.db:kodein-db-jvm:_" )
5051 implementation(" org.kodein.db:kodein-db-serializer-kotlinx:_" )
5152 implementation( " org.kodein.db:kodein-leveldb-jni-jvm-linux:_" )
Original file line number Diff line number Diff line change 1+ @file:Suppress(" PackageDirectoryMismatch" )
2+
3+ package playground.markdown
4+
5+ import org.intellij.markdown.IElementType
6+ import org.intellij.markdown.ast.ASTNode
7+ import org.intellij.markdown.ast.accept
8+ import org.intellij.markdown.ast.acceptChildren
9+ import org.intellij.markdown.ast.getTextInNode
10+ import org.intellij.markdown.ast.visitors.Visitor
11+ import org.intellij.markdown.flavours.commonmark.CommonMarkFlavourDescriptor
12+ import org.intellij.markdown.html.HtmlGenerator
13+ import org.intellij.markdown.parser.MarkdownParser
14+ import playground.shouldBe
15+
16+
17+ /* *
18+ * jetbrains/markdown : Multiplatform Markdown processor written in Kotlin
19+ *
20+ * - [Website](https://github.com/JetBrains/markdown)
21+ * - [Github](https://github.com/JetBrains/markdown)
22+ */
23+ fun main (){
24+ generateHtml()
25+ }
26+
27+
28+ fun generateHtml () {
29+ val src = " Some *Markdown*"
30+ val flavour = CommonMarkFlavourDescriptor ()
31+ val parsedTree = MarkdownParser (flavour).buildMarkdownTreeFromString(src)
32+ val html = HtmlGenerator (src, parsedTree, flavour).generateHtml()
33+ html shouldBe """ <body><p>Some <em>Markdown</em></p></body>"""
34+ }
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ fun main() {
3030 playground.kotlinx.html.main()
3131 playground.kotlinx.serialization.main()
3232 playground.ktor.client.main()
33+ playground.markdown.main()
3334 playground.mordant.main()
3435 playground.moshi.main()
3536 playground.okhttp.main()
Original file line number Diff line number Diff line change @@ -88,6 +88,8 @@ version.okhttp3=4.9.1
8888
8989version.org.amshove.kluent..kluent =1.65
9090
91+ version.org.jetbrains..markdown-jvm =0.2.2
92+
9193version.org.jetbrains.exposed..exposed-core =0.30.2
9294
9395version.org.jetbrains.exposed..exposed-dao =0.30.2
You can’t perform that action at this time.
0 commit comments