Getting started
A short guide to installing and reading with asciidoc-kmp.
Install
Add the dependency in your build.gradle.kts:
repositories {
mavenCentral()
}
dependencies {
implementation("org.markup-poet:asciidoc-parser:0.1.1")
implementation("org.markup-poet:html-renderer:0.1.1")
}asciidoc-kmp targets the JVM, Android, iOS, Linux, macOS, and the browser (Kotlin/Wasm) from a single source tree.
Parse a document
import org.markup.poet.asciidoc.parser.DefaultAsciidocParser
val source = """
= Structure is a form of verse
Markup Poets
Consider the paragraph as a breath.
""".trimIndent()
val result = DefaultAsciidocParser().parse(source)
result.errors.forEach { println("line ${it.line}: ${it.message}") }
val doc = result.document // the Abstract Semantic Graph
println(doc.header?.title) // [InlineText("Structure is a form of verse")]
println(doc.attributes["author"]) // Markup Poets
Render to HTML
import org.markup.poet.asciidoc.render.* val builder = DefaultHtmlBuilder(DefaultHtmlEscaper()) val inlines = DefaultInlineRenderer(builder) val renderer = DefaultHtmlRenderer(DefaultBlockRenderer(builder, inlines), inlines) val html = renderer.render(doc, RenderConfig.default()).getOrThrow()
The renderer ships built-in themes (Default, Dark, Kotlin, Minimal) plus CSS-variable and custom-CSS seams — or set standalone = false in OutputOptions for a bare fragment you style yourself. The live demo on the front page is exactly this pipeline, compiled to WebAssembly.
Status
v0.1.1 supports sections, paragraphs, ordered/unordered/description/ callout lists, tables, admonitions, sidebars, examples, quotes, verbatim blocks, includes, conditionals, cross-references, footnotes, and rich inline formatting — tracked against the official AsciiDoc Language TCK. Markdown-style blockquotes and full location fidelity are still in progress.
The project is early. Bug reports and edge cases are the most welcome form of contribution.