Docs DMD reference Authoring guide
Authoring guide · DMD

Docs Markdown Directives

Package documentation is Markdown under docs/ at the root of the repo. This page is the reference of the directives available on top of plain CommonMark — each section prints the source you write, then what the docs site renders from it.

Introduction

DMD is plain CommonMark plus a small set of directives written as HTML comments that start with @. A file that uses none of them renders exactly as CommonMark — GitHub shows the same file cleanly, because the comments are invisible there.

  • Block directives open and close on their own lines: <!-- @callout --> … <!-- @endcallout -->.
  • Self-closing directives have no body: <!-- @method name="…" -->, @version-badge, @video.
  • Inline self-closing directives may sit inside a paragraph and flow with the text.

Page structure

Each page is one .md file. The first # heading is the page title; every ## heading is listed under "On this page". Folders under docs/ become URL segments.

md docs/guide/getting-started.md
---
eyebrow: 'phpbm · Guide'
lede:    'From an empty machine to a blinking board.'
---

# Getting started

## Once per machine

Plain CommonMark and directives go here.

Frontmatter

Optional YAML block at the top of the file. Every key is optional.

KeyUsed for
titleBrowser <title> and H1 when the body has no H1.
eyebrowSmall all-caps label above the H1.
ledeOne-sentence summary under the H1; also the meta description.
see_alsoRelated links at the bottom — each entry needs href, optional label and meta.
prev / nextPrevious / next page cards: href + label.
yaml frontmatter
---
eyebrow: 'phpbm · Guide'
lede:    'From an empty machine to a blinking board.'
see_also:
  - { href: './project.md', meta: 'Guide' }
  - { href: '../reference/troubleshooting.md', meta: 'Reference' }
prev: { label: 'Overview', href: '../overview.md' }
next: { label: 'The project', href: './project.md' }
---

index.md & sidebar

docs/index.md defines the left sidebar as a nested list: top-level bullets are section titles, nested links are pages. A plain-text entry is a placeholder.

md docs/index.md
- Overview
  - [Overview](./overview.md)
- Guide
  - [Getting started](./guide/getting-started.md)
  - [The project](./guide/project.md)
  - Toolchains  (placeholder, not yet written)

Renders as

Overview

Guide

Markdown basics

Plain CommonMark (with tables) gets the datasheet prose styles: condensed headings, square list markers, ruled tables, inline code chips.

md source
### A third-level heading

Body copy in Plex Sans with **strong text**, *emphasis*, `inline_code()` and a [link to the overview](https://php-baremetal.com).

- Unordered items get square ember markers
- Nested lists keep the rhythm
  - like this one
- Third item

1. Ordered items use mono ordinals
2. Second step

| Runtime | Entry point | Needs |
| --- | --- | --- |
| `init-loop` | `setup()` / `loop($tick)` | — |
| `event-driven` | event sources | `ext-events` |

> A blockquote, for quoting a datasheet or an error message.

```text
plain fenced code (no @code-block) renders as a dark panel
```

Renders as

A third-level heading

Body copy in Plex Sans with strong text, emphasis, inline_code() and a link to the overview.

  • Unordered items get square ember markers
  • Nested lists keep the rhythm
    • like this one
  • Third item
  1. Ordered items use mono ordinals
  2. Second step
Runtime Entry point Needs
init-loop setup() / loop($tick) —
event-driven event sources ext-events

A blockquote, for quoting a datasheet or an error message.

text
plain fenced code (no @code-block) renders as a dark panel

Callouts

Highlight a note, tip, warning, danger or info block. variant defaults to note; title is optional.

md source
<!-- @callout variant="note" title="Test every minor, on a board" -->
A note: context the reader may need, with `inline code`.
<!-- @endcallout -->

<!-- @callout variant="tip" -->
A tip without a title uses the variant name.
<!-- @endcallout -->

<!-- @callout variant="warning" title="Flash wears out" -->
The persistent `store_*` functions write to flash — keep them off the hot path.
<!-- @endcallout -->

<!-- @callout variant="danger" title="The store can be wiped at boot" -->
Something that loses data or bricks a board.
<!-- @endcallout -->

<!-- @callout variant="info" title="Info" -->
Neutral background information.
<!-- @endcallout -->

Renders as

Note Test every minor, on a board

A note: context the reader may need, with inline code.

Tip

A tip without a title uses the variant name.

Warning Flash wears out

The persistent store_* functions write to flash — keep them off the hot path.

Danger The store can be wiped at boot

Something that loses data or bricks a board.

Info

Neutral background information.

Do / Don't

Side-by-side good / bad example. The body must contain exactly one @do and one @dont.

md source
<!-- @do-dont -->
<!-- @do -->
Call `gpio_mode($pin, GPIO_OUTPUT)` before writing — the direction is explicit.
<!-- @enddo -->
<!-- @dont -->
Write to a pin you never configured; it may float, and readers of your code can't see what the pin is for.
<!-- @enddont -->
<!-- @enddo-dont -->

Renders as

Do

Call gpio_mode($pin, GPIO_OUTPUT) before writing — the direction is explicit.

Don't

Write to a pin you never configured; it may float, and readers of your code can't see what the pin is for.

Method signatures

Introduces a command, function or method. Self-closing; often followed by @params.

md source
<!-- @method name="phpbm build [--clean] [--merged]" -->

<!-- @method name="gpio_write(int $pin, int $value)" returns="void" visibility="public" -->

Renders as

Signature
phpbm build [--clean] [--merged]
Signature · public returns void
gpio_write(int $pin, int $value)

Parameter lists

@params wraps @param children with name, type, required and default, plus a Markdown description.

md source
<!-- @params heading="Arguments and options" -->
<!-- @param name="dir" type="path" -->
Directory of the new project; created if missing.
<!-- @endparam -->
<!-- @param name="--board" type="string" required="true" -->
A board id of the SDK. Asked when the SDK has several.
<!-- @endparam -->
<!-- @param name="--runtime" type="string" default="init-loop" -->
One of the runtimes the board can run.
<!-- @endparam -->
<!-- @endparams -->

Renders as

Arguments and options
dir
path optional

Directory of the new project; created if missing.

--board
string required

A board id of the SDK. Asked when the SDK has several.

--runtime
string optional
default init-loop

One of the runtimes the board can run.

Code blocks

Wraps exactly one fenced block with the docs chrome: language, optional label, copy button and Shiki highlighting. Languages: php, bash, sh, text, toml, ini, c, cmake, diff, yml, cs, go, json, blade.php.

md source
<!-- @code-block language="PHP" label="project-src/index.php" -->
```php
<?php
// LED + ~330 ohm resistor between GPIO2 and GND.

function setup(): void {
    gpio_mode(2, GPIO_OUTPUT);
}

function loop(int $tick): void {
    gpio_write(2, $tick % 2);
    delay(500);
}
```
<!-- @endcode-block -->

Renders as

PHP project-src/index.php
<?php
// LED + ~330 ohm resistor between GPIO2 and GND.

function setup(): void {
    gpio_mode(2, GPIO_OUTPUT);
}

function loop(int $tick): void {
    gpio_write(2, $tick % 2);
    delay(500);
}

Tabs

Alternative views of the same content. labels is comma-separated; @tab children are indexed from zero. Arrow keys move between tabs.

md source
<!-- @tabs labels="Composer, PHAR on Linux and macOS, Notes" -->
<!-- @tab index="0" -->
<!-- @code-block language="Bash" label="once per machine" -->
```bash
composer global require php-baremetal/phpbm
composer global require php-baremetal/conductor
```
<!-- @endcode-block -->
<!-- @endtab -->
<!-- @tab index="1" -->
<!-- @code-block language="Bash" label="once per machine" -->
```bash
curl -fLO https://github.com/php-baremetal/phpbm/releases/latest/download/phpbm.phar
chmod +x phpbm.phar
sudo mv phpbm.phar /usr/local/bin/phpbm
```
<!-- @endcode-block -->
<!-- @endtab -->
<!-- @tab index="2" -->
A tab can hold plain Markdown too: **any** content, not only code.
<!-- @endtab -->
<!-- @endtabs -->

Renders as

Bash once per machine
composer global require php-baremetal/phpbm
composer global require php-baremetal/conductor

Steps

Numbered walkthrough. The body must be a single Markdown list; a leading **bold** becomes the step title.

md source
<!-- @steps -->
- **Install phpbm and the conductor**

  `composer global require php-baremetal/phpbm php-baremetal/conductor`.

- **Install an SDK**

  `phpbm sdk:install esp32` downloads the newest `esp32` SDK release.

- **Flash**

  `phpbm flash` builds if needed, then flashes the connected board.
<!-- @endsteps -->

Renders as

  1. Step 1: Install phpbm and the conductor

    composer global require php-baremetal/phpbm php-baremetal/conductor.

  2. Step 2: Install an SDK

    phpbm sdk:install esp32 downloads the newest esp32 SDK release.

  3. Step 3: Flash

    phpbm flash builds if needed, then flashes the connected board.

Section divider

Visual break between topical groups inside a page: eyebrow label plus a one-line description.

md source
<!-- @divider eyebrow="Advanced" -->
For the curious — the bits below are not required for everyday usage.
<!-- @enddivider -->

Renders as

Advanced

For the curious — the bits below are not required for everyday usage.

Version badge

Added / changed / deprecated / removed markers, standalone or inline in a paragraph.

md source
<!-- @version-badge type="added" version="0.3.0" date="2026-10-02" -->

The store keeps values across reboots. <!-- @version-badge type="changed" version="0.2.0" --> <!-- @version-badge type="deprecated" version="0.3.0" --> <!-- @version-badge type="removed" version="1.0.0" -->

Renders as

Added in 0.3.0 · 2026-10-02

The store keeps values across reboots. Changed in 0.2.0 Deprecated in 0.3.0 Removed in 1.0.0

Keyboard keys

The plain HTML <kbd> element, restyled as a key cap — no directive needed.

md source
Press <kbd>Ctrl</kbd> + <kbd>]</kbd> to leave `phpbm monitor`.

Renders as

Press Ctrl + ] to leave phpbm monitor.

Video

<!-- @video src="…" poster="…" caption="…" --> embeds an MP4 with native controls, loading only its metadata until played. Used by blog articles; no preview here because it needs a media file.

Cross-references

Write relative Markdown links to other pages, as in a GitHub README. On the docs site, links to .md files become the version-pinned URL of that page; anchors are kept and external URLs pass through.

md source
See [the overview](./overview.md) for the simpler case.
Anchors are preserved: [the project file](./guide/project.md#composer-json).
External URLs pass through unchanged: [php.net](https://www.php.net).
Tip Authoring tip
Never hard-code absolute docs URLs: relative links keep working on every release tag of the package without edits.

Badges & see also

Page chrome built from the package row and the frontmatter.

Package types

Tool SDK Extension Interface HAL

Source

First-party Community Organization

See also (frontmatter see_also)

Master branch banner

MASTER You're reading the master branch — unreleased changes that may not match the latest tag. Switch to v0.3.0 →