Markup Poet DSL
A type-safe Kotlin DSL for building markup documents. You describe a document — sections, paragraphs, code blocks, tables, lists, graphs — against an abstract, format-agnostic model, and writer modules produce AsciiDoc, Markdown (GFM), or Graphviz DOT source text from it. Built with Kotlin Multiplatform, so the same code runs on JVM, Android, iOS, and native desktop targets. This project is the DSL poet of the Markup Poet family, alongside the AsciiDoc parser.
Quick start
Build a document in Kotlin:
import org.markup.poet.dsl.document.article
import org.markup.poet.dsl.document.ListType
import org.markup.poet.dsl.write.asciidoc.toAsciidoc
val doc = article("Markup Poet") {
section("Usage") {
+"A DSL for markup documents."
code("kotlin") {
+"val doc = article {}"
}
list(ListType.ORDERED) {
+"build"
+"write"
}
}
}
println(doc.toAsciidoc())
toAsciidoc() produces AsciiDoc source text:
= Markup Poet
== Usage
A DSL for markup documents.
[source,kotlin]
----
val doc = article {}
----
. build
. write
Where to go next
-
New here? Follow the Getting started tutorial.
-
Task-focused? Head to the how-to guides, for example Write Markdown output, Build a standalone table, or Stream output with Flow.
-
Looking things up? See Modules and coordinates and the rest of the reference section.
-
Want to understand the design? Read Sub-DSL architecture.
-
Contributing? Start at Contributing.
Coordinates
All artifacts are published under the org.markup-poet group at version 0.2.0 on Maven Central:
| Artifact | Contents |
|---|---|
|
Standalone table model + DSL, zero deps |
|
Abstract document model + |
|
Standalone graph model + DSL (nodes/edges), zero deps |
|
Writes the models as AsciiDoc source text |
|
Writes the models as Markdown (GFM) source text |
|
Writes graphs as Graphviz DOT source text |
Supported platforms: JVM, Android (API 24+), iOS, Linux, macOS. Licensed under the Apache License, Version 2.0 — see the repository for details.