Current scope: kotmark-renderer-kotlinx-html| all classes
|
io.heapy.kotmark.renderer.kotlinxhtml.adapters
Coverage Summary for Class: MathAdapterKt (io.heapy.kotmark.renderer.kotlinxhtml.adapters)
| Class | Method, % | Branch, % | Line, % | Instruction, % |
|---|---|---|---|---|
| MathAdapterKt | 100% (3/3) | 100% (7/7) | 100% (9/9) | |
| MathAdapterKt$mathAdapter$1$1$1 | 100% (1/1) | 100% (1/1) | 100% (5/5) | |
| MathAdapterKt$mathAdapter$1$2$1 | 100% (1/1) | 100% (1/1) | 100% (5/5) | |
| MathAdapterKt$mathAdapter$lambda$0$$inlined$nodeRenderer$1 | 0% (0/1) | |||
| MathAdapterKt$mathAdapter$lambda$0$$inlined$nodeRenderer$1$1 | 0% (0/2) | |||
| MathAdapterKt$mathAdapter$lambda$0$$inlined$nodeRenderer$2 | 0% (0/1) | |||
| MathAdapterKt$mathAdapter$lambda$0$$inlined$nodeRenderer$2$1 | 0% (0/2) | |||
| Total | 45.5% (5/11) | 100% (9/9) | 100% (19/19) |
package io.heapy.kotmark.renderer.kotlinxhtml.adapters
import io.heapy.kotmark.ext.math.InlineMath
import io.heapy.kotmark.ext.math.MathBlock
import io.heapy.kotmark.renderer.kotlinxhtml.KotlinxHtmlAdapter
import io.heapy.kotmark.renderer.kotlinxhtml.nodeRenderer
/** Emits escaped TeX source in math containers. Typesetting/KaTeX assets belong to the application. */
fun mathAdapter(): KotlinxHtmlAdapter = KotlinxHtmlAdapter { configuration ->
configuration.nodeRenderer<InlineMath> { node ->
element(node, "span", mapOf("class" to "math math-inline")) { text(node.literal) }
}
configuration.nodeRenderer<MathBlock> { node ->
element(node, "div", mapOf("class" to "math math-block")) { text(node.literal) }
}
}