Skip to main content

Golem Documentation

Michael Bernstein

AsciiDoc Authoring & Partial Files Protocol

Golem supports full standards-compliant AsciiDoc across 39 node types, rendered through Chameleon ZPT templates.

Supported AsciiDoc Constructs

1. Admonition Blocks

Golem supports all 5 standard admonitions with distinctive, color-coded callout boxes:

Admonition Callouts
ASCIIDOC
[NOTE]
====
Informational note for helpful side details.
====

[TIP]
====
Pro-tip for efficiency or performance.
====

[IMPORTANT]
====
Essential requirement or critical design invariant.
====

[WARNING]
====
Cautionary warning against breaking changes or syntax errors.
====

[CAUTION]
====
High-risk warning for potential data loss or security issues.
====

Informational note for helpful side details.

Pro-tip for efficiency or performance.

Essential requirement or critical design invariant.

Cautionary warning against breaking changes or syntax errors.

High-risk warning for potential data loss or security issues.

2. Source Code, Listing Headers & Callouts

Golem provides rich, IDE-style code listings with semantic header bars, block titles, uppercase language badges, test/state role badges, and one-click clipboard copying.

hello_golem.py
PYTHON
import click1

@click.command()2
def hello():
    click.echo("Hello, Golem!")
  1. 1 Import the click CLI framework.
  2. 2 Decorate the function as a command entry point.

Listing Headers, Badges & Clipboard Copying

When authoring code blocks in AsciiDoc:

  • Block Titles & Filenames: Prefixing a block with .filename.py or .Title renders a clean, styled .listing-title in the top header bar.
  • Language Badges: Specifying [source,python] or [source,toml] automatically displays a capitalized language badge (e.g. PYTHON, TOML, ASCIIDOC) via .badge.badge-lang.
  • Role Badges: Specifying role="test", role="shared", or role="reset" in block attributes renders distinctive semantic role badges (.badge-test, .badge-shared, .badge-reset) to indicate test isolation or execution state.
  • One-Click Clipboard Copy: Every listing header includes an accessible copy button (.listing-copy-btn). Clicking the button copies the listing's code directly to the user's clipboard and displays a visual confirmation checkmark.
Stateful Test Listing Example
ASCIIDOC
.pipeline_config.py
[source,python,role="shared test"]
----
base_url = "https://example.com/api"
timeout = 30
----

Multi-View Derived Renderings

Technical documentation often needs to demonstrate not just raw AsciiDoc source code, but also how that source is parsed, compiled, or visually rendered. Golem includes a built-in Multi-View Derived Rendering Engine that compiles code snippets into interactive tabbed containers at build time.

The render Attribute & Aliases

To generate derived multi-view tabs, author a [source,asciidoc] block and specify the render attribute (or one of its aliases: views, display, formats):

Multi-View Syntax Example
ASCIIDOC
.Interactive Admonition Demo
[source,asciidoc,render="source,asg,html,preview"]
----
[NOTE]
====
This note is rendered into AsciiDoc, ASG JSON, HTML, and Live Preview tabs!
====
----

Supported View Channels

Golem supports four canonical compilation view channels:

View Channel

Aliases

Description

source

asciidoc, adoc, src

The raw, syntax-highlighted AsciiDoc input snippet (Tab label: AsciiDoc).

asg

ast, json

The parsed Abstract Semantic Graph (ASG) dictionary serialized as formatted, syntax-highlighted JSON (Tab label: ASG).

html

rendered-html, markup

The compiled HTML5 fragment source code, syntax-highlighted (Tab label: HTML).

preview

live, rendered, view

The live, interactive HTML component rendered directly inside a .rendered-preview container (Tab label: Preview).

Live Multi-View Demonstrations

1. Source & Live Preview (render="source,preview")

Formatted Text Callout
ASCIIDOC
[TIP]
====
Multi-view blocks make it easy for readers to compare AsciiDoc markup with its rendered visual output.
====

Multi-view blocks make it easy for readers to compare AsciiDoc markup with its rendered visual output.

2. Full Multi-View Pipeline (render="source,asg,html,preview")

Rich Content Block Pipeline
ASCIIDOC
* *Bold Emphasis*
* _Italic Text_
* `Inline Monospace`
{
  "name": "document",
  "type": "block",
  "location": [
    {
      "line": 1,
      "col": 1
    },
    {
      "line": 3,
      "col": 20
    }
  ],
  "blocks": [
    {
      "name": "list",
      "type": "block",
      "location": [
        {
          "line": 1,
          "col": 1
        },
        {
          "line": 3,
          "col": 20
        }
      ],
      "variant": "unordered",
      "marker": "*",
      "items": [
        {
          "name": "listItem",
          "type": "block",
          "location": [
            {
              "line": 1,
              "col": 1
            },
            {
              "line": 3,
              "col": 20
            }
          ],
          "marker": "*",
          "principal": [
            {
              "name": "span",
              "type": "inline",
              "location": [
                {
                  "line": 1,
                  "col": 3
                },
                {
                  "line": 1,
                  "col": 17
                }
              ],
              "variant": "strong",
              "form": "constrained",
              "inlines": [
                {
                  "name": "text",
                  "type": "string",
                  "location": [
                    {
                      "line": 1,
                      "col": 4
                    },
                    {
                      "line": 1,
                      "col": 16
                    }
                  ],
                  "value": "Bold Emphasis"
                }
              ]
            }
          ],
          "blocks": []
        },
        {
          "name": "listItem",
          "type": "block",
          "location": [
            {
              "line": 2,
              "col": 1
            },
            {
              "line": 2,
              "col": 15
            }
          ],
          "marker": "*",
          "principal": [
            {
              "name": "span",
              "type": "inline",
              "location": [
                {
                  "line": 2,
                  "col": 3
                },
                {
                  "line": 2,
                  "col": 15
                }
              ],
              "variant": "emphasis",
              "form": "constrained",
              "inlines": [
                {
                  "name": "text",
                  "type": "string",
                  "location": [
                    {
                      "line": 2,
                      "col": 4
                    },
                    {
                      "line": 2,
                      "col": 14
                    }
                  ],
                  "value": "Italic Text"
                }
              ]
            }
          ],
          "blocks": []
        },
        {
          "name": "listItem",
          "type": "block",
          "location": [
            {
              "line": 3,
              "col": 1
            },
            {
              "line": 3,
              "col": 20
            }
          ],
          "marker": "*",
          "principal": [
            {
              "name": "span",
              "type": "inline",
              "location": [
                {
                  "line": 3,
                  "col": 3
                },
                {
                  "line": 3,
                  "col": 20
                }
              ],
              "variant": "code",
              "form": "constrained",
              "inlines": [
                {
                  "name": "text",
                  "type": "string",
                  "location": [
                    {
                      "line": 3,
                      "col": 4
                    },
                    {
                      "line": 3,
                      "col": 19
                    }
                  ],
                  "value": "Inline Monospace"
                }
              ]
            }
          ],
          "blocks": []
        }
      ]
    }
  ]
}
<ul class="ulist"><li><strong>Bold Emphasis</strong></li>
<li><em>Italic Text</em></li>
<li><code>Inline Monospace</code></li>
</ul>
  • Bold Emphasis
  • Italic Text
  • Inline Monospace

Zero-JS Baseline & Progressive Enhancement

Golem's multi-view tab system is engineered with progressive enhancement and accessibility:

  • Zero-JS Baseline: When JavaScript is unavailable or disabled, the first tab is active and visible by default, while subsequent tab panes are hidden using standard HTML hidden attributes. All content is fully indexed by search engines and readable in text browsers.
  • Interactive Tab Switching: With JavaScript enabled, clicking any tab button or navigating via keyboard arrows (role="tab", role="tablist", role="tabpanel") toggles the visible pane with seamless transitions.
  • Context-Aware Clipboard Copying: When viewing a multi-view container, the clipboard copy button automatically targets the code or text of whichever tab is currently active (e.g. copying JSON when the ASG tab is selected, or raw HTML when the HTML tab is selected).

Other AsciiDoc Constructs

3. Structured Tables

Tables support explicit column widths, header alignment, cell-level alignment, and embedded formatting.

Column Widths & Alignment

Use the cols= attribute to define column proportions and alignment per column:

Alignment Specifiers

Specifier

Meaning

CSS class applied

<

Left-align

halign-left

^

Center-align

halign-center

>

Right-align

halign-right

(none)

Default (left)

—

Column Alignment Example
ASCIIDOC
[cols="<,^,>"]
|===
| Left | Center | Right

| a | b | c
| d | e | f
|===

Left

Center

Right

a

b

c

d

e

f

Proportional widths can be combined with alignment:

ASCIIDOC
[cols="2<,1^,1>"]
|===
| Wide Left | Narrow Center | Narrow Right
|===

Golem propagates column-level halign/valign values down to each cell automatically. Cell-level attributes always take precedence over column-spec defaults.

Table Striping, Frame & Grid

Control the visual style of table borders and row striping with standard AsciiDoc table attributes:

ASCIIDOC
[cols="1,2", stripes="even", frame="all", grid="rows"]
|===
| Name | Value
| alpha | 1
| beta  | 2
|===

Supported stripes values: even, odd, hover, none (default).
Supported frame values: all, sides, topbot, none.
Supported grid values: all, cols, rows, none.

CLI Commands Summary
ASCIIDOC
[cols="1,2,1"]
|===
| Command | Purpose | Default Port

| `golem serve` | Live-reload development server | `8000`
| `golem build` | Compile static site to `dist/` | N/A
|===

Command

Purpose

Default Port

golem serve

Live-reload development server

8000

golem build

Compile static site to dist/

N/A

3a. Dot-Ordered Lists

Dot-ordered (numbered) lists use a leading period (.) as the marker:

ASCIIDOC
. First item
. Second item
. Third item
  1. First item
  2. Second item
  3. Third item

A parser quirk in asciidoctrine ≥ 0.2.0a5 can cause the first item of a dot-ordered list to be mistakenly treated as the list's title, making it disappear from rendered output. Golem automatically detects and repairs this during the ASG post-processing pass — authors do not need to work around it.

4. Mathematical Expressions (STEM)

Inline formulas and block equations:

STEM Mathematical Equations
ASCIIDOC
:stem: latexmath

Inline formula: stem:[E = mc^2]

[stem]
++++
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
++++

Inline formula: E=mc2

∑i=1ni=n(n+1)2

5. Description Lists & Footnotes

Hierarchical term-definition syntax and anchored footnotes:

Core Architecture Concepts
ASCIIDOC
AST:: Concrete Abstract Syntax Tree parsed by Lark.
ASG:: Semantic Abstract Semantic Graph resolved by `asciidoctrine` footnote:[Named after the compiler intermediate representation.]
AST

Concrete Abstract Syntax Tree parsed by Lark.

ASG

Semantic Abstract Semantic Graph resolved by asciidoctrine 1


1. Named after the compiler intermediate representation.

Partial Files Protocol (_*.adoc)

In large technical books and manuals, chapters are often split across reusable sub-units included into parent documents via include::path.adoc[].

Any file prefixed with an underscore (e.g. _header.adoc, _sidebar_notes.adoc, _footer.adoc) is treated as a Partial File.

  • No Standalone Compilation: Partial files are never compiled into standalone HTML files in dist/.
  • DAG Dependency Tracking: When a partial file is modified, Golem's incremental DAG compiler traverses .golem/cache.json and automatically rebuilds every parent document that includes it.