Small library that provides an ability to render commonmark-java parsing result into kotlinx.html stream
The main part of this library.
For general information please read commonmark-java
readme
repositories {
jcenter()
}
dependencies {
implementation("ru.krikun.commonmark:commonmark-kotlinx-html:0.1.2")
}
createHTML().html {
body {
val document: Document = ... // Parse document using commonmark-java parser.
val renderer = buildKotlinxHtmlRenderer()
renderer.render(document, stream)
}
}
or use kotlin extension function:
div {
val document: Document = ... // Parse document using commonmark-java parser.
render(document)
}
For general information about extensions see commonmark-java
readme
Note: commonmark-kotlinx-html
extensions use internal implementation of parsing part from original commonmark-java
extensions.
So you don't need add original extension to the parser. Use commonmark-kotlinx-html
extension instead.
Enables adding auto generated "id" attributes to heading tags.
Use HeadingAnchorKotlinxHtmlExtension
dependencies {
implementation("ru.krikun.commonmark:commonmark-kotlinx-html-heading-anchor:0.1.2")
}
Also, see commonmark-java
description.
Enables underlining of text by enclosing it in ++
.
Use InsKotlinxHtmlExtension
dependencies {
implementation("ru.krikun.commonmark:commonmark-kotlinx-html-ins:0.1.2")
}
Also, see commonmark-java
description.
Enables strikethrough of text by enclosing it in ~~
.
Use StrikethroughKotlinxHtmlExtension
.
dependencies {
implementation("ru.krikun.commonmark:commonmark-kotlinx-html-strikethrough:0.1.2")
}
Also, see commonmark-java
description.
Enables tables using pipes as in GitHub Flavored Markdown.
Use TablesKotlinxHtmlExtension
dependencies {
implementation("ru.krikun.commonmark:commonmark-kotlinx-html-tables:0.1.2")
}
Also, see commonmark-java
description.
Dependency | Version |
---|---|
kotlin-jvm | 1.4.10 |
kotlinx.html | 0.7.2 |
commonmark-java | 0.15.2 |
Copyright 2020 OlegKrikun
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.