
Markdown parser exposing an immutable, canonical AST with consistent bindings; offers parsing, traversal, canonical dumps, and incremental sessions with stable node identities and efficient reparsing.
Markdown Core is a cross-platform Markdown parser with a shared immutable abstract syntax tree (AST) for C, Swift, Kotlin, and ECMAScript. One C engine provides consistent parsing behavior and source locations across all bindings.
The library provides synchronous parsing and read-only AST traversal. It has one Markdown dialect with no parse options. Applications own rendering and keep the source text when they need it; the parser does not retain the input.
Read the Markdown syntax guide to learn the language, or the documentation index for the AST and source-location contracts.
The Swift package supports iOS 26 and macOS 26 or later. Add the MarkdownCore
product to your target:
.package(url: "https://github.com/nouprax/markdown-core", from: "3.0.0")import MarkdownCore
let document = try Document.parse("Hello, Markdown.")
print(document.dump())The AST is an immutable, Sendable value tree with typed visitors and
stack-safe walking. Child relations use read-only MarkupCollection and
MarkupGroups values with constant-time random access; use Array(...) when
an array is required. Retaining a subtree keeps its immutable Swift store alive.
The native C document is freed before parse returns. See
Swift storage for ownership and lifecycle
details.
Add the dependency to a Kotlin Multiplatform source set:
kotlin {
sourceSets {
commonMain.dependencies {
implementation("com.nouprax:kotlin-markdown-core:3.0.0")
}
}
}import com.nouprax.markdown.core.Document
val document = Document.parse("Hello, Markdown.")
println(document.dump())Supported targets are Android API 21 or later, JVM 17, macOS arm64, and Linux
x64. Native runtime dependencies are included. On JDK 26 or later, launch JVM
applications with --enable-native-access=ALL-UNNAMED to avoid the native-access
warning from the JNI loader.
pnpm add @nouprax/es-markdown-coreimport { Document, MarkupDumper } from "@nouprax/es-markdown-core";
const document = Document.parse("Hello, Markdown.");
console.log(MarkupDumper.dump(document));The ESM package supports Node.js 20 or later and browsers that can load its WebAssembly asset. Parsing is synchronous once the import resolves. TypeScript values are recursively readonly; JavaScript objects are not runtime-frozen.
Link the installed CMake target:
find_package(markdown-core CONFIG REQUIRED)
target_link_libraries(my-app PRIVATE markdown-core::markdown-core)Include <markdown_core.h> and call markdown_core_document_parse. Release
successful parses with markdown_core_document_free; node and string views
borrow from that document. Release errors and allocated dumps with
markdown_core_error_free and markdown_core_dump_free.
Independent parses may run concurrently. Read-only access to a document is safe while it remains alive. See the public C header for the complete API and ownership rules.
Start with the toolchain and environment guide, validate
your setup with scripts/init-environment.sh --check, then install dependencies:
pnpm install --frozen-lockfileBuild the package you are working on:
pnpm build:c
pnpm build:swift
scripts/gradle.sh :packages:kotlin-markdown-core:jvmJar
pnpm --dir packages/es-markdown-core buildThe C CLI at build/cmake/packages/markdown-core/core/markdown-core reads files
or standard input and prints a debug AST dump. To install the C library:
cmake --install build/cmake --prefix /path/to/prefixRun the tests for your host, such as pnpm test:c-host and
pnpm conformance:c-host. See testing for all
platform targets, sanitizers, conformance checks, and benchmarks. pnpm verify
runs the repository's formatting, lint, contract, and audit checks.
The four bindings live in packages/; shared executable fixtures live in
specs/. Reader documentation lives in docs/specs/, implementation design in
docs/architecture/, and consumer examples in samples/.
For releases, follow the release guide and change log.
Markdown Core is an independent project derived from cmark, cmark-gfm, and DongyuZhao/cmark-gfm. It preserves the applicable upstream copyright and license notices. See LICENSE, COPYING, and UPSTREAM.md for licensing and lineage.
Markdown Core is a cross-platform Markdown parser with a shared immutable abstract syntax tree (AST) for C, Swift, Kotlin, and ECMAScript. One C engine provides consistent parsing behavior and source locations across all bindings.
The library provides synchronous parsing and read-only AST traversal. It has one Markdown dialect with no parse options. Applications own rendering and keep the source text when they need it; the parser does not retain the input.
Read the Markdown syntax guide to learn the language, or the documentation index for the AST and source-location contracts.
The Swift package supports iOS 26 and macOS 26 or later. Add the MarkdownCore
product to your target:
.package(url: "https://github.com/nouprax/markdown-core", from: "3.0.0")import MarkdownCore
let document = try Document.parse("Hello, Markdown.")
print(document.dump())The AST is an immutable, Sendable value tree with typed visitors and
stack-safe walking. Child relations use read-only MarkupCollection and
MarkupGroups values with constant-time random access; use Array(...) when
an array is required. Retaining a subtree keeps its immutable Swift store alive.
The native C document is freed before parse returns. See
Swift storage for ownership and lifecycle
details.
Add the dependency to a Kotlin Multiplatform source set:
kotlin {
sourceSets {
commonMain.dependencies {
implementation("com.nouprax:kotlin-markdown-core:3.0.0")
}
}
}import com.nouprax.markdown.core.Document
val document = Document.parse("Hello, Markdown.")
println(document.dump())Supported targets are Android API 21 or later, JVM 17, macOS arm64, and Linux
x64. Native runtime dependencies are included. On JDK 26 or later, launch JVM
applications with --enable-native-access=ALL-UNNAMED to avoid the native-access
warning from the JNI loader.
pnpm add @nouprax/es-markdown-coreimport { Document, MarkupDumper } from "@nouprax/es-markdown-core";
const document = Document.parse("Hello, Markdown.");
console.log(MarkupDumper.dump(document));The ESM package supports Node.js 20 or later and browsers that can load its WebAssembly asset. Parsing is synchronous once the import resolves. TypeScript values are recursively readonly; JavaScript objects are not runtime-frozen.
Link the installed CMake target:
find_package(markdown-core CONFIG REQUIRED)
target_link_libraries(my-app PRIVATE markdown-core::markdown-core)Include <markdown_core.h> and call markdown_core_document_parse. Release
successful parses with markdown_core_document_free; node and string views
borrow from that document. Release errors and allocated dumps with
markdown_core_error_free and markdown_core_dump_free.
Independent parses may run concurrently. Read-only access to a document is safe while it remains alive. See the public C header for the complete API and ownership rules.
Start with the toolchain and environment guide, validate
your setup with scripts/init-environment.sh --check, then install dependencies:
pnpm install --frozen-lockfileBuild the package you are working on:
pnpm build:c
pnpm build:swift
scripts/gradle.sh :packages:kotlin-markdown-core:jvmJar
pnpm --dir packages/es-markdown-core buildThe C CLI at build/cmake/packages/markdown-core/core/markdown-core reads files
or standard input and prints a debug AST dump. To install the C library:
cmake --install build/cmake --prefix /path/to/prefixRun the tests for your host, such as pnpm test:c-host and
pnpm conformance:c-host. See testing for all
platform targets, sanitizers, conformance checks, and benchmarks. pnpm verify
runs the repository's formatting, lint, contract, and audit checks.
The four bindings live in packages/; shared executable fixtures live in
specs/. Reader documentation lives in docs/specs/, implementation design in
docs/architecture/, and consumer examples in samples/.
For releases, follow the release guide and change log.
Markdown Core is an independent project derived from cmark, cmark-gfm, and DongyuZhao/cmark-gfm. It preserves the applicable upstream copyright and license notices. See LICENSE, COPYING, and UPSTREAM.md for licensing and lineage.