Elixir implementation of A2ML (Attested Markup Language) parser and renderer.
A2ML is a structured markup language with built-in attestation provenance, directive metadata, and trust-level tracking. This library provides a complete parser and renderer for A2ML documents in pure Elixir.
-
Parse A2ML documents from strings or files
-
Render AST back to A2ML surface syntax (round-trip support)
-
Typed AST with structs for blocks, inlines, directives, and attestations
-
Trust-level hierarchy:
:unverified,:automated,:reviewed,:verified -
Directive blocks with key-value attributes
-
Attestation provenance chain
-
Zero dependencies beyond Elixir standard library
Add to your mix.exs:
defp deps do
[{:a2ml_ex, git: "https://github.com/hyperpolymath/a2ml_ex.git"}]
endThen run:
mix deps.get
mix compile# Parse A2ML document
{:ok, document} = A2ML.parse("# Hello World\n\nSome **bold** text.")
# Render back to A2ML
{:ok, rendered} = A2ML.render(document)
# Handle parse errors
{:error, %A2ML.ParseError{}} = A2ML.parse("invalid syntax")| Module | Purpose |
|---|---|
|
Main module - re-exports public API |
|
Document struct and functions |
|
Block-level elements (headings, paragraphs, lists, etc.) |
|
Inline elements (bold, italic, code, links, etc.) |
|
Directive blocks with attributes |
|
Attestation provenance and trust levels |
|
Parser implementation (string to AST) |
|
Renderer implementation (AST to string) |
|
Error types and handling |
# Heading
Paragraph with **bold**, *italic*, `code`, [link](url), and @ref(id).
@directive-name(key=val): single line value
@multi-line:
Content spanning
multiple lines
@end
!attest
identity: Jonathan D.A. Jewell
role: author
trust-level: verified
timestamp: 2026-03-16T00:00:00Z
!end
- Bullet list item
- Another item
> Block quote text
```elixir
defmodule Example do
def hello, do: "world"
end
```mix deps.get # Install dependencies
mix compile # Compile project
mix test # Run tests
mix format # Format code
mix creds check # Check credentialsAdd to config/config.exs:
config :a2ml_ex,
default_trust_level: :reviewed,
strict_mode: true-
a2ml-deno — Deno/ReScript implementation
-
a2ml-rs — Rust implementation
-
a2ml-haskell — Haskell implementation
-
a2ml_gleam — Gleam implementation
-
tree-sitter-a2ml — Tree-sitter grammar
-
vscode-a2ml — VS Code extension
A2ML supports four trust levels in a hierarchy:
| Level | Meaning |
|---|---|
|
Content has not been reviewed or attested |
|
Content generated or verified by automated systems |
|
Content reviewed by human but not formally verified |
|
Content formally verified with cryptographic attestation |
Directives provide metadata and processing instructions:
@page-break
@toc(depth=3): Table of Contents
@include(file="chapter1.a2ml"):
@template(name="article"):
# {title}
By {author}
{content}
@endAttestations provide cryptographic provenance:
!attest
identity: Alice Smith
role: Editor
trust-level: verified
timestamp: 2026-03-16T12:00:00Z
signature: 0xabc123...
!endThe Elixir implementation is optimized for:
-
Fast parsing of large documents
-
Memory-efficient AST representation
-
Concurrent rendering capabilities
-
Stream processing support
SPDX-License-Identifier: PMPL-1.0-or-later
Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath)
See LICENSE for full license text.
See CONTRIBUTING.adoc for contribution guidelines.
See ROADMAP.adoc for planned features and enhancements.