kotmark

A Markdown engine
Kotlin Multiplatform

Extension 09 / kotmark-ext-ins

Inserted text

The inserted-text extension creates inline nodes and renders them with the HTML ins element.

Artifact
io.heapy.kotmark:kotmark-ext-ins:0.1.0
Package
io.heapy.kotmark.ext.ins

Usage

Enable inserted text
import io.heapy.kotmark.ext.ins.ins
import io.heapy.kotmark.extensions
import io.heapy.kotmark.parser.parser
import io.heapy.kotmark.renderer.html.htmlRenderer

fun renderWithIns(markdown: String): String {
    val extensions = extensions { ins() }
    val document = parser { extensions(extensions) }.parse(markdown)
    return htmlRenderer { extensions(extensions) }.render(document)
}

Example

INPUT · Markdown
Kotmark is ++multiplatform++.
OUTPUT · HTML
<p>Kotmark is <ins>multiplatform</ins>.</p>

Output

The HTML renderer emits <ins>multiplatform</ins>. This syntax is opt-in and does not alter ordinary plus signs.