stnd.build · DocumentationSTANDARD MANUALSTD-SYNTAX-P · 2026-03-15
STD-SYNTAX-P

::Syntax Pattern System

::Syntax Pattern System

The ::syntax system provides a friendly, readable notation for common layout patterns in markdown content. Inspired by Obsidian’s callout syntax and MDX component model, it bridges the gap between plain markdown and complex HTML layouts.

Philosophy

“Markup should be readable by humans, not just machines.” — Tim Berners-Lee

The ::syntax system follows three principles:

  1. Minimal — Change as few lines as possible to achieve rich layouts
  2. Readable — Patterns are self-documenting and intuitive
  3. Composable — Patterns can be nested and combined naturally

Pattern Types

1. Smart Paragraph Patterns

Single-line directives that affect the next paragraph without needing ::end.

<div class=“hero”>

This paragraph will be rendered with hero styling (larger text).

Renders as:

<p class="hero">
  This paragraph will be rendered with hero styling (larger text).
</p>

Available Smart Patterns:

2. Inline Patterns

Single-line directives with immediate content.

<aside class=“note”>This is an important reminder for later.</aside>

Renders as:

<aside class="note">This is an important reminder for later.</aside>

Available Inline Patterns:

3. Block Patterns

Multi-line containers with ::end delimiter. Perfect for complex layouts.

<div class=“callout” data-callout=“tip”>
<div class=“callout-title”>
<span class=“callout-icon”>💡</span>
<span class=“callout-title-inner”>Tip</span>
</div>
<div class=“callout-content”>

This is a helpful tip that can span multiple lines.
You can include **markdown** inside!

</div>
</div>

Renders as:

<div class="callout" data-callout="tip">
  <div class="callout-title">
    <span class="callout-icon">💡</span>
    <span class="callout-title-inner">Tip</span>
  </div>
  <div class="callout-content">
    <p>
      This is a helpful tip that can span multiple lines. You can include
      <strong>markdown</strong> inside!
    </p>
  </div>
</div>

Built-in Block Patterns

Callouts (Obsidian-style)

<div class=“callout” data-callout=“note”>
<div class=“callout-title”>
<span class=“callout-icon”>📝</span>
<span class=“callout-title-inner”>Note</span>
</div>
<div class=“callout-content”>

Standard callout with note styling

</div>
</div>


<details class=“callout” data-callout=“tip” open>
<summary class=“callout-title”>
<span class=“callout-icon”>💡</span>
<span class=“callout-title-inner”>Tip</span>
</summary>
<div class=“callout-content”>

Collapsible callout that starts open (+ indicator)

</div>
</details>


<details class=“callout” data-callout=“warning”>
<summary class=“callout-title”>
<span class=“callout-icon”>⚠️</span>
<span class=“callout-title-inner”>Warning</span>
</summary>
<div class=“callout-content”>

Collapsible callout that starts closed (- indicator)

</div>
</details>

Callout Types:

Layout Containers

::hero center

# Welcome to Standard Garden

Beautiful typography meets Swiss grid systems.
::end

<div class=“container-small”>

This content will be contained in a small-width container.
Perfect for focused reading.

</div>


<div class=“container-accent”>

This content will be highlighted with accent styling.

</div>


<div class=“container-feature”>

This content will be displayed in a feature-sized container.

</div>


<div class=“center”>

This content will be centered on the page.

</div>

Grid Layouts

Columns (with separator)

<div class=“columns-2”>
<div class=“column”>

Left column content with **markdown** support.

</div>
<div class=“column”>

Right column content with images and links.

</div>
</div>

Split (asymmetric columns)

<div class=“grid”>
<div class=“sm:row col-8”>

Main content area (8/12 width).

</div>
<div class=“sm:row col-4”>

Sidebar content (4/12 width).

</div>
</div>

Cards Grid

<div class=“grid-1”>
<div class=“sm:row card”>

## Card One

## Content for the first card.

## Card Two

## Content for the second card.

## Card Three

Content for the third card.

</div>
</div>

The grid automatically detects the number of cards and distributes them evenly.

Generic Grid

<div class=“grid-2”>
<div class=“sm:row”>

Item 1 content

</div>
<div class=“sm:row”>

## Item 2 content

Item 3 content

</div>
</div>

Auto-detects item count and creates responsive grid.

Media Patterns

Image with Caption

<figure class=“image-wide”>
  <img src=“/path/to/image.jpg” alt=“This is the image caption that appears below.“>
  <figcaption>This is the image caption that appears below.</figcaption>
</figure>

<div class=“gallery grid gap-4”>
  <div class=“col-12 md:col-6”>
    <img src=“/images/photo1.jpg” alt=“”>
  </div>
  <div class=“col-12 md:col-6”>
    <img src=“## /images/photo2.jpg

/images/photo3.jpg” alt=“”>
  </div>
</div>

Interactive Patterns

Button

<a href=“/destination-url” class=“button button-primary”>Click Me</a>

Form

<form class=“form form-contact” method=“POST” action=“/api/contact”>
  <div class=“form-field”>
    <label for=“name”>Name</label>
    <input type=“text” id=“name” name=“name” required>
  </div>
  <div class=“form-field”>
    <label for=“email”>Email</label>
    <input type=“email” id=“email” name=“email” required>
  </div>
  <div class=“form-field”>
    <label for=“message”>Message</label>
    <textarea id=“message” name=“message” required></textarea>
  </div>
  <button type=“submit” class=“button button-primary”>Send</button>
</form>

Creates a form with the specified fields. Automatically detects field types:

Usage in Standard Garden

The ::syntax system runs in the pre-processing stage, before markdown-it parses the content. This means:

  1. ✅ Patterns are transformed to HTML first
  2. ✅ Markdown inside patterns is processed normally
  3. ✅ Patterns can be nested (with care)
  4. ✅ Content remains portable (patterns are just directives)

Detection Logic

The system only activates when it detects :: at the start of a line:

This won't trigger: ::hero (not at line start)

<div class=“hero”>

This will trigger (at line start)

Pattern Priority

Patterns execute in priority order (lower = first):

  1. Priority 40 — Block patterns (::callout, ::columns, etc.)
  2. Priority 50 — Smart paragraph patterns (::hero, ::feature)
  3. Priority 60 — Inline patterns (::note, ::alert, etc.)

This ensures complex blocks process before simple inline directives.

Debugging

Unprocessed patterns are logged as warnings:

stdn::gd [Syntax] ⚠ Unprocessed pattern: ::unknown

Check your pattern name matches a registered pattern.

Examples

Blog Post Header

::hero center

# The Art of Typography

## A journey through 500 years of printing tradition

::end

<aside class=“note”>Published on December 27, 2025</aside>

The golden ratio has guided…

Documentation Page

<details class=“callout” data-callout=“tip” open>
<summary class=“callout-title”>
<span class=“callout-icon”>💡</span>
<span class=“callout-title-inner”>Tip</span>
</summary>
<div class=“callout-content”>

Use the `—ink` CSS variable instead of `—color-foreground` for better semantic clarity.

</div>
</details>


<div class=“grid”>
<div class=“sm:row col-8”>

## Main Content

Your documentation content here with **markdown**.

</div>
<div class=“sm:row col-4”>

## Table of Contents – [Section 1](#section-1) – [Section 2](#section-2)

</div>
</div>

Product Showcase

<div class=“grid-3”>
<div class=“sm:row card”>

## Fast

Lightning-fast edge rendering with Cloudflare Workers.

</div>
<div class=“sm:row card”>

## Beautiful

Swiss typography applied automatically.

</div>
<div class=“sm:row card”>

## Sustainable

$200/month for 10,000 users.

</div>
</div>

Migration from 11ty

If you’re migrating from the legacy 11ty version, all patterns remain compatible. The only changes:

  1. ::hero without ::end → Smart paragraph pattern (affects next paragraph)
  2. ::hero-block with ::end → Block container (multi-paragraph hero section)

Same applies to ::feature and ::feature-block.

Technical Details

Location: packages/press/typography/syntax.js
Stage: pre (runs before markdown parsing)
Priority: 10 (runs very early)
Integration: Registered in typography plugin system

The processor uses regex-based pattern matching with three handlers:

Best Practices

  1. Use smart patterns for single paragraphs — Cleaner syntax
  2. Use block patterns for complex content — More control
  3. Keep pattern nesting shallow — Easier to debug
  4. Always close with ::end — For block patterns
  5. Test patterns in isolation — Before nesting

Future Enhancements

Potential additions (not yet implemented):


The ::syntax system is your friend. Use it to make content beautiful without writing HTML.