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

Coordinates

All artifacts are published under the org.markup-poet group at version 0.2.0 on Maven Central:

Artifact Contents

markup-table

Standalone table model + DSL, zero deps

markup-document

Abstract document model + article DSL, zero deps

markup-graph

Standalone graph model + DSL (nodes/edges), zero deps

markup-asciidoc-writer

Writes the models as AsciiDoc source text

markup-markdown-writer

Writes the models as Markdown (GFM) source text

markup-dot-writer

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.