Gutterpress proof

Markdown & CSS, typeset for printOpen source · by Dimm City

Writing Your Content

Gutterpress renders standard GitHub-flavored markdown to print-quality HTML. This chapter covers headings, text, tables, and the @-prefixed layout markers that control how content flows across pages --- and calls out, wherever it matters, which behaviors are core Gutterpress and which come from this guide's own guide.css.

Headings

Six heading levels map to standard HTML:

# H1 --- Chapter Title

## H2 --- Major Section

### H3 --- Subsection

#### H4 --- Minor Heading

##### H5 --- Small Heading

###### H6 --- Tiny Heading

Core Gutterpress renders these as plain <h1>--<h6> --- nothing more. A new page on every H1, a running header, and the big chapter numeral are this guide's own theme (guide.css), not core:

/* guide.css -- a project theme, NOT core Gutterpress */
h1 {
  break-before: page;              /* starts a new page on every H1 */
  page: chapter;
  counter-increment: chapter;
  /* ...type styling... */
}
h1 { string-set: chapter-title content(); }        /* feeds the running header */
h1::before { content: counter(chapter, decimal-leading-zero); /* ...the numeral... */ }

A brand-new Gutterpress project has none of this --- headings are inert HTML until your own CSS (or a bundled theme, see Chapter 4) styles them. If you want core, marker-driven pagination instead of an H1-triggered break, use @chapter / @page / @page-break --- see Layout Directives below.

Heading rules

Text Formatting

*Italic text* or _italic text_

**Bold text** or __bold text__

***Bold italic*** or ___bold italic___

`Inline code or monospace`

~~Strikethrough~~

Lists

Unordered list:
- First item
- Second item
  - Nested item
- Third item

Ordered list:
1. First step
2. Second step
   1. Substep A
   2. Substep B
3. Third step

Use ordered lists for sequential steps. Use unordered lists for non-ordered items. Keep nesting to two levels maximum.

Blockquotes

> This is a blockquote.
> It can span multiple lines and paragraphs.
>
> And have multiple paragraphs.

Core Gutterpress emits a plain <blockquote>. The left border and tinted background you see rendered in this guide come from guide.css --- bring your own blockquote rule (or a bundled theme) to get that look in your own project.

Math

Turn on the bundled Math feature (gutterpress-math under extensions:, or Book setup → Extensions in the desktop; see Chapter 5) and write LaTeX math the way every LaTeX author already does: $...$ inside a line, $$...$$ on lines of its own.

The loss $\mathcal{L}(\theta)$ is minimised with step size $\eta_t$.

$$
\hat{\theta} = \operatorname*{arg\,min}_{\theta} \frac{1}{n} \sum_{i=1}^{n} \ell(f_\theta(x_i), y_i)
\tag{1}
$$

MathJax typesets each formula as a drawing of its own glyphs, so the PDF needs no math font on the computer that builds it and no stylesheet or font files in your project, and the preview paginates exactly like the PDF. The usual LaTeX packages are there --- aligned, cases and matrix environments, \mathbb, \operatorname, \tag, \newcommand, and the rest of MathJax's set.

A dollar sign that does not open a formula is a dollar sign: $5 and $10 prints as typed, because a formula never opens before a space or closes before a digit. A formula MathJax cannot typeset prints in red and is reported in Problems with its line and what is wrong, so a missing brace never goes unnoticed.

Tables

| Header 1 | Header 2 | Header 3 |
|----------|----------|----------|
| Cell 1   | Cell 2   | Cell 3   |
| Cell 4   | Cell 5   | Cell 6   |

Alignment:
| Left   | Center | Right |
|:-------|:------:|------:|
| Text   | Text   |    42 |

GFM tables render as standard <table><thead>...</thead><tbody>...</tbody></table>. Tables are standard GFM, with one Gutterpress rule about | (below). Because the header row is real <thead> markup, Chromium can repeat it when a table is forced to break across a page --- standard CSS table fragmentation, independent of any stylesheet.

Alternating row shading and keeping a whole table on one page (table { break-inside: avoid; }) are this guide's guide.css, not core. A bare Gutterpress project renders plain, unshaded tables that may break anywhere; add your own break-inside: avoid rule to a table or an explicitly classed @section when it must stay together.

The alignment row becomes a plain data-align="left|center|right" attribute on each cell, not an inline style, so your stylesheet can change one column's alignment without !important: td[data-align="right"] { text-align: center; }.

A | separates cells, so a cell that needs one in plain text writes it as \|. Inside a code span or a formula a | is just that character --- the cell is not split. A code span also accepts GitHub's spelling, \|, and prints it as |, so a table that lints clean elsewhere prints the same here. A row with more cells than the header is reported in Problems rather than having its extra cells silently dropped.

Keep tables simple --- 5 to 7 columns maximum. Align numbers right, text left.

Markdown Attributes

Add CSS classes, IDs, and attributes to any element using markdown-it-attrs syntax (bundled --- no install step needed):

# Chapter Title {#custom-id .special-class}

Paragraph with custom styling. {.highlight}

![Image](photo.jpg){.gp-center .gp-size-50}

[Link text](page.html){.download}

.gp-center and .gp-size-50 above come from core Gutterpress's built-in gp-* image vocabulary --- position, size, and spacing classes that compose --- see Chapter 3, Common image classes for the full set.

Cross-References

# Chapter One {#chapter-one}

Content here...

Later, reference it: [See Chapter One](#chapter-one)

Headings do not get an automatic id from their text --- core Gutterpress has no heading-slug step. Give a heading an explicit id with {#custom-id} (via markdown-it-attrs) before linking to it with #custom-id.

Layout Directives

Layout directives are @-prefixed markers that control how content flows across pages. They are built into Gutterpress --- this is core behavior, present in every project regardless of theme.

Quick syntax reference

Marker Effect
@chapter Wrap content in a chapter; a bare label auto-injects a .chapter-opener on its first page
@spread Start a two-page spread group
@page Start a new page (optionally named and/or classed)
@page-break Hard break, no page wrapper emitted
@section Wrap related content in a structural group for styling and layout
@end-section Close the current @section (no-op if none is open); stays on the same page
@continue Close the current @section and reopen a matching one, marked .gp-continued
@column-break Force a column break inside a multi-column section

Writing about a marker without triggering it

A marker is any line whose first character is @ followed by one of the words above --- including a line your paragraph happened to wrap onto. Write a sentence about the @page marker and your editor may reflow it so @page lands at the start of a line, and Gutterpress will split your page there.

Escape it with a backslash, exactly as you would escape any other markdown punctuation, or write it as inline code:

A pinned image sets itself against the
\@page container it sits in.

A pinned image sets itself against the
`@page` container it sits in.

Both render the text @page and leave your page alone. If you ever see a page break you did not ask for, look for a line that begins with @ --- Gutterpress warns about most of these, and the warning names the escape.

@chapter --- chapter wrapper (with automatic chapter-opener)

@chapter is the flagship layout marker. It wraps everything until the next @chapter (or end of file) in <div class="chapter">. When given a bare label, it also auto-injects a chapter-opener element into the first @page inside it --- the only element Gutterpress generates on your behalf:

@chapter C.01 #ch-bestiary

@page

# Bestiary

Monsters and their stat blocks...

Renders:

<div class="chapter" data-chapter-label="C.01" id="ch-bestiary">
  <div class="page" data-chapter-label="C.01">
    <div class="chapter-opener" data-chapter-label="C.01">C.01</div>
    <h1>Bestiary</h1>
    <p>Monsters and their stat blocks...</p>
  </div>
</div>

@page --- start a new page

Starts a new page. A single bare word names the page; .class shorthand (or class=a,b) adds CSS classes --- these are two different things:

@page

@page intro

@page .cover .sidebar

@page intro .cover

Marker classes may also use markdown-it-attrs braces. For example, @page {.cover .sidebar} is equivalent to @page .cover .sidebar, and @section {.sidebar} is equivalent to @section .sidebar.

Two or more bare words with no .class/class= are all treated as classes, with no name at all --- @page cover sidebar renders <div class="page cover sidebar">, no data-page. For predictable results, always use .class shorthand (or class=...) when you want a class, and reserve a single bare word for the page's name.

Page variants

Some page names are variants: the word also adds a class, so the page can be styled by what kind of page it is. Core ships two:

Marker Class added What it does
@page blank gp-page-blank A page with empty margin boxes --- no running head, no folio drawn. The page still counts in the page numbering, and its content is untouched.
@page full-bleed gp-page-full-bleed A page with zero margin, so its content box is the whole sheet. Running heads and folios are cleared on it too.
@page full-bleed

![Map of the city](map.jpg)

renders <div class="page gp-page-full-bleed" data-page="full-bleed">. A theme or plugin can declare more (@page chapter-start, @page intro) --- see Page, chapter and section variants --- and then style them by location: .page.dc-page-chapter-start .section { ... }. data-page is still emitted, any other single word is still just a free page name, and a raw class (@page .dc-page-chapter-start) works the same as the variant word. If you mistype a variant (@page chapter-strat), Problems tells you what you probably meant.

If your own CSS gives every .page a page: name, that rule is yours and wins over a variant's --- name pages with data-page selectors instead.

@page-break --- hard break

Forces a page break without creating a <div class="page"> wrapper. Use when you want a break inside flowing content without a new named page:

Content above.

@page-break

Content below, on a new page.

Renders <div class="gp-page-break" aria-hidden="true"></div> between the two paragraphs --- a plain marker element, not a page container. Like the other markers it keeps a #id (@page-break #part-two), which is what a link or a page-number reference lands on.

@section and @end-section

@section wraps related content in a structural group. Core keeps the group's first child from being stranded by itself at a page boundary, but deliberately does not put break-inside: avoid on the whole section: long sections must be allowed to fragment. Add that stronger rule to an explicitly classed section in your project CSS only when the entire group really must stay together. Close with @end-section, which stays on the current page rather than forcing a break:

@section

## Character Stats

| Stat | Value |
|------|-------|
| HP   | 45    |
| AC   | 16    |

@end-section

Continues on the same page as the section above.

@section emits <div class="section"> --- plain .section, never .region.

A plugin can declare section variants (@section card): the word also adds the variant's class, data-section is still emitted, and any other word stays a free section name. See Page, chapter and section variants.

@continue --- split a named section without losing its identity

@continue closes the currently open @section and immediately reopens a new one with the same name and attributes, plus an extra gp-continued class. Use it when a named block has to spill past a break but you still want to style the overflow (e.g. a "(continued)" label) without repeating its heading:

@section Notes

First part of a long note...

@continue

The overflow, continuing.

@end-section

Renders:

<div class="section" data-section="Notes">
  <p>First part of a long note...</p>
</div>
<div class="section gp-continued" data-section="Notes">
  <p>The overflow, continuing.</p>
</div>

An id names one element, so the continuation does not repeat the section's #id; it keeps everything else, including its data-name (see Targeting one block from your stylesheet). Style only the first piece with :not(.gp-continued).

@continue used with no open @section is dropped with a warning --- it does not resurrect a section already closed by @end-section.

@columns, @column-break and @spread

@columns is the one way to put content in columns. Give it the number of columns, 1 to 5 (a bare @columns is @columns 2), and everything up to @end-columns is laid out in that many columns. @column-break moves to the next column. @columns does nothing else: no border, no background, none of the styling your theme gives a section. @spread groups content into a two-page spread.

@columns 2

Left column content.

@column-break

Right column content.

@end-columns

Any other number (@columns 6) is reported as a problem and gives two columns. @columns closes at the next @page, @spread or @chapter.

Sections go inside columns, and columns go inside sections. Each @section you open between @columns and @end-columns is a box of its own inside the run, and a new @section closes the previous one and starts the next in the same columns:

@columns 2

@section .note
First note.

@section .note
Second note, beside the first.

@end-columns

Want a heading across the full width, or a different number of columns halfway down the page? End the run, write the content, and open a new one:

@columns 3

Short entries, three across.

@end-columns

## A heading across the full width

@columns 2

Longer notes, two across.

@end-columns

A run that crosses a page break fills its columns one page at a time, so a long run is best split where the page ends: close it and open a new @columns on the next page.

Column styling is two settings in your stylesheet (or theme), not extra classes:

Setting Default Meaning
--gp-column-gap 1.5em The gutter between columns.
--gp-column-rule none A line between columns, written like column-rule (1px solid #999).
:root {
  --gp-column-gap: 0.4in;
  --gp-column-rule: 0.5pt solid #999;
}

Fragmentation: .gp-no-break and .gp-break-before

Two more generic classes, useful anywhere:

Class Meaning
.gp-no-break Keeps the element from splitting across a page break (break-inside: avoid).
.gp-break-before Forces a fresh page before the element (break-before: page).

Writing Guidelines

Paragraphs