Template placeholders

Template placeholders are tokens in HTML shims that Mech replaces at render time. Use them to control where metadata, structured content, and interactive runtime mounts are inserted.

Overview

A placeholder is written as {{NAME}} and is replaced during HTML rendering.

This allows one Mechdown source document to be rendered into different layouts by swapping shims while keeping content semantics the same.

Core placeholders

  • {{STYLESHEET}} — Injected CSS content.

  • {{TITLE}} — Document title text.

  • {{AUTHOR}} — Inline author paragraph from title front matter.

  • {{DATE}} — Inline date paragraph from title front matter.

  • {{KICKER}} — Inline kicker paragraph from title front matter.

  • {{NEXT}} — Inline next-link paragraph from title front matter.

  • {{PREVIOUS}} — Inline previous-link paragraph from title front matter.

  • {{HERO}} — Hero media/content from the title block.

  • {{SUMMARY}} — Synopsis content from the title block.

  • {{TOC}} — Generated table of contents.

  • {{ABSTRACT}} — Content from %% abstract blocks.

  • {{INTRO}} — Unsectioned intro content before the first numbered section.

  • {{CONTENTS}} — Sectioned document body contents.

  • {{CONTENT}} — Alias for {{CONTENTS}}.

  • {{CITED}} — Works Cited markup (when citations are present).

  • {{SECTION#}} — Specific numbered section slot ({{SECTION1}}, {{SECTION2}}, ...).

Interactive placeholders

These placeholders support browser-side Mech runtime integration.

  • {{CODE}} — Base64+compressed serialized program payload (when built with serde support). This is used by web runtime bootstrap code to reconstruct and run the page program.

  • {{REPL}} — Default REPL mount markup:

<div class="console-scroll mech-repl hidden" id="mech-output"></div>

The web runtime expects a mount with id mech-output when calling attach_repl.

### Reactive variable placeholders

You can embed live interpreter variables directly in a template placeholder:

  • {{VAR:x}} — Reads variable x from the default interpreter.

  • {{VAR:x@foo}} — Reads variable x from interpreter foo.

These bindings are reactive. If x changes in Mech, the rendered value in the

document updates automatically.