In short
A small book of four nature poems by Gerard Manley Hopkins. It shows how to keep each line of verse on its own, with the poet's original indents and a blank line between verses.
What you'll build
A chapbook of four nature poems by Gerard Manley Hopkins, 140 × 216 mm, in the text of the 1918 first edition. After the half-title, a frontispiece photogram of fern and rowan faces a title page set in Italiana. The contents list each poem by numeral and italic title, with spaced dots to the page number. Each poem opens a page under a sage numeral and its italic title. Every poem is a :::verse block, indented as in 1918: the lines of Pied Beauty step in by rhyme, and the long lines of The Windhover turn over and hang 4 em in, twice as deep as its indents. Stanzas are one line apart, and no word is broken except where Hopkins broke it. The date goes under each poem, flush right, and a rowan sprig follows the last one. The poem pages carry a centred folio at the foot.
This recipe answers
- How do I set poetry: one line per verse, stanza gaps, hanging indents for wrapped lines, no hyphenation?
- How do I add extra vertical space between two blocks, when blank lines do nothing?
- How do I add a table of contents that updates itself (leaders, page numbers, authors, part rows)?
- How do I set an epigraph, a dedication, a signature, or a pull quote with a big quote mark?
- How do I set unnumbered artwork: ornaments, vignettes, logos?
The short answer
// A poem is one :::verse block written as it is printed: a line of verse a line, a blank line
// between stanzas (one line of the grid), and spaces before an indented line, two to an em:
// :::verse{style="verse" align=start}
// The world is charged with the grandeur of God.
// It will flame out, like shining from shook foil;
//
// And for all this, nature is never spent;
// :::
// align=start sets the poem flush with the margin (the default centres it on its longest line).
const verse = {
id: 'verse',
hangingIndent: em(2), // a turnover hangs 2 em past its line's start: 4 em under a 2 em indent
// Verse keeps its words whole, even where bodyText.hyphenation.ragged is switched on.
hyphenation: false,
};
// Hook-up: paragraphStyles: [verse, …]; the Markdown goes to buildDocument as it is written.
Verse: a :::verse block keeps each line, its indent, the stanza breaks
Ingredients
- Features
- Verse line by lineParagraph stylesTable of contentsExplicit vertical spaceIndents, alignment and paragraph spacingEscapes and literal charactersNumbered headingsDesigned openersHeading stylesUnnumbered chaptersHeading attributesPictures in page designsCovers, title pages and colophonsDocument metadataRunning heads per sectionRunning heads and foliosCustom resource typesFigures exactly hereSemantic colour paletteHeads by page role
- Type
- Sorts Mill Goudy, Italiana, Marcellus SC (SIL OFL 1.1)
- Assets
plate-1120.jpg- The frontispiece photogram of fern and rowan (Generated With Diffusion Models, original)
- The rowan ornament, drawn in code in the page’s palette (Ignacio Ferro, CC BY 4.0)
Method
#1 · A poem is a :::verse block
A :::verse block keeps each line of the Markdown as a line of verse, so the poem is written as it is printed (:::verse). Its leading spaces are its indents, two to an em, so the lines that rhyme with one another start the same distance in, as in 1918. A blank line between stanzas leaves one line of the grid, and is dropped at the top of a page. A line too long for the measure turns over at a word space and hangs by the verse style's hangingIndent, counted from the line's own start: 2 em past an unindented line, 4 em under a line indented 2 em, so a turnover never reads as a line of its own. align=start sets each poem flush with the margin; without it a poem is centred on its longest line. Verse is not hyphenated, and a line never parts from its turnover at a page break.

#2 · The lines around a poem have styles too
const lineStyles = [
{ id: 'dedication', fontSize: pt(9.5), marginBottom: pt(LEAD) }, // under The Windhover
{ id: 'date', fontFamily: 'Marcellus SC', fontSize: pt(8), color: col('muted'),
textAlign: 'right', marginTop: pt(LEAD) }, // a line of space above, flush right
];
The dedication above The Windhover and the place and date under each poem are not lines of verse, so each one is a :::paragraphs container of one paragraph, in a style of its own. Neither style sets a leading, and their margins are one line (15 pt), so the verse stays on the body's grid. The date is set one line below the poem, flush right, in 8 pt Marcellus SC, the face of the folios.
#3 · Every poem opens a page under its number
// '{1:I}' numbers the poems I to IV: {number} prints the numeral here, :::toc in the contents.
// The head is HEAD_LINES grid lines (minHeight, no bottom margin), so each poem starts on the same
// line; numeral and title fill 4, or 5 if the title wraps.
const HEAD_LINES = 6;
const poemHead = { enabled: true, minHeight: pt(LEAD * HEAD_LINES), slot: { elements: [
{ kind: 'text', id: 'numeral', content: '{number}', fontFamily: 'Italiana', fontSize: pt(22),
color: col('sage'), align: 'left',
placement: { anchor: { to: 'container', edge: 'top-left' } } },
{ kind: 'text', id: 'title', content: '{titleText}', fontFamily: 'Sorts Mill Goudy',
italic: true, fontSize: pt(17), color: col('ink'), align: 'left',
placement: { anchor: { to: '#numeral', edge: 'below' }, offset: { y: mm(2) },
size: { width: 'fill' } } },
] } };
// Parity 'any': the next page, recto or verso, with no blank page between two poems.
const poems = { level: 1, numberingTemplate: '{1:I}', advancedDesign: poemHead,
marginBottom: pt(0), breakBefore: { enabled: true, parity: 'any' } };
Instead of its text, the heading prints a design in the column. In that design, {number} is the count as numberingTemplate: '{1:I}' formats it, I to IV, and {titleText} is the title (span and advanced design). The level has no bottom margin, and minHeight makes every head six grid lines deep (31.75 mm). The numeral and a one-line title fill four of them, and a title that wraps fills five, so every poem starts on the same line of its page. On page 6 that line holds the dedication. Parity 'any' breaks to the next page, recto or verso, so there are no blank pages between the poems.
#4 · The front matter is made of headings
// Headings too, each on a page of its own, with no number, contents entry or folio.
// A style restates the break, or inherits the poems' (gotcha: style-inherits-break).
const leaf = { numbered: false, toc: false, span: 'page', footer: { elements: [] },
breakBefore: { enabled: true, parity: 'any' } };
const onPage = (y, width) => ({ anchor: { to: 'page', edge: 'top' }, offset: { y: mm(y) },
...(width && { size: { width: mm(width) } }) }); // centred, y mm below the trim
const face = (id, content, font, size, y, extra = {}) => ({ kind: 'text', id, content,
fontFamily: font, fontSize: pt(size), color: col('ink'), align: 'center',
placement: onPage(y), ...extra });
const image = (id, placement) => ({ kind: 'image', id, resourceId: id, placement });
const design = (...elements) => ({ enabled: true, slot: { elements } });
const front = [
{ id: 'half-title', ...leaf,
advancedDesign: design(face('title', '{titleText}', 'Italiana', 20, 60)) },
{ id: 'plate', ...leaf, advancedDesign: design( // span 'page': a column's foot would cut it
image('plate', { anchor: { to: 'bleed', edge: 'top-left' }, size: { width: 'fill' } }),
face('caption', '{attr.caption}', 'Sorts Mill Goudy', 8.5, 203,
{ italic: true, color: col('muted') })) },
{ id: 'title-page', ...leaf, advancedDesign: design(
face('author', '{author}', 'Marcellus SC', 10, 46, // {author}, {title}: the frontmatter
{ letterSpacing: pt(2.4), textTransform: 'uppercase' }),
face('title', '{title}', 'Italiana', 54, 56, { lineHeight: 1 }),
face('subtitle', '{subtitle}', 'Sorts Mill Goudy', 13, 80,
{ italic: true, color: col('sage') }),
image('sprig', onPage(96, 30)),
face('press', '{attr.press}', 'Marcellus SC', 8.5, 182,
{ letterSpacing: pt(1.8), color: col('muted') })) },
{ id: 'contents', ...leaf, span: 'column', advancedDesign: { enabled: false },
fontFamily: 'Italiana', fontSize: pt(24), lineHeight: pt(LEAD * 2), marginBottom: pt(LEAD) },
];
A heading style can break to a new page and draw a design there, so the half-title, the frontispiece and the title page are one heading each, with a style of its own. numbered: false keeps them out of the count, and the first poem is still I. toc: false keeps them out of the contents, and an empty footer leaves their pages without a folio (heading styles). The styles span the page because the foot of the text block cuts a design kept in the column, which would crop the full-bleed plate there and lose its caption. The caption comes from the heading's caption attribute; the author, title and subtitle on the title page come from the frontmatter.
#5 · The contents fill themselves in
// The numerals stand on the titles' baseline, in Italiana and sage, at the titles' size.
const contents = {
levels: [{ level: 1, italic: true, marginBottom: pt(LEAD), numberFontFamily: 'Italiana',
numberFontWeight: 400, numberColor: col('sage'), numberWidth: mm(6), numberGap: mm(3) }],
pageNumber: { fontFamily: 'Marcellus SC', fontSize: pt(9), color: col('muted'), width: mm(6) },
leader: { char: '. ', gap: mm(2) }, // spaced dots, right-aligned so they line up
};
:::toc lists every heading whose style lets it in, with the numeral from the same template and the label of the page where the heading lands. The build lays the book out again until those page labels stop changing (table of contents). The page's own heading, Contents, has a style with numbered: false; without it, Contents would be poem I. The leader '. ' puts a space after each dot. The dots are right-aligned, so they line up from one entry to the next, and they print in the page numbers' face and colour because toc.leader has no colour setting.
#6 · An ornament is a resource type with no label
// No caption prefix and no caption: the sprig prints bare, where ::resource{id="sprig"} puts
// it (double quotes: gotcha resource-double-quotes), a fifth of the measure wide, centred.
const ornament = { id: 'ornament', name: 'Ornament', shortLabel: '', captionPrefix: '',
numberingTemplate: '{n}', resetOn: 'never', counterFormat: 'decimal',
defaultPlacement: { position: 'here', width: 0.2, align: 'center' } };
A picture in the text is a resource, and every resource has a type. The ornament type has an empty caption prefix and the sprig has no caption, so no label such as "Figure 1" prints under it (resource types). The type's defaultPlacement puts the sprig where ::resource{id="sprig"} stands, centred and a fifth of the measure wide, so the tailpiece under Inversnaid takes one line of Markdown. resourceTypes replaces the default list, so this book has no Figure or Table type. To keep them, spread defaultResourceTypes() in front of the ornament.
The whole recipe
// ═══ Postext Cookbook · Nº 015 · Poems set line by line ═════════════════════════════
// https://postext.dev/en/cookbook/poetry-collection
// Code: MIT · Text: G. M. Hopkins, Poems, 1918 (PD) · Plate: diffusion models · Sprig: code
// Fonts: Sorts Mill Goudy, Italiana, Marcellus SC (SIL OFL 1.1) · Needs postext ≥ 1.34.0
import {
buildDocumentWithFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';
const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'poetry-collection';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
const palette = { // every colour in the config links to one of these
ink: '#26221f', // the text: a warm near-black
sage: '#56673f', // the one accent: numerals, the subtitle, the ornament's leaves
sepia: '#8c5f3a', // used for the rowan berries only
muted: '#746a60', // dates, folios, leaders and the colophon
paper: '#fbf8f2', // the page
};
// A colour is its hex and the palette entry it follows.
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = [
...Object.entries(palette).map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } })),
// The engine's defaults link to 'main-color': point it at the accent, so nothing prints blue.
{ id: 'main-color', name: 'accent (defaults)', value: { hex: palette.sage, model: 'hex' } },
];
const TRIM_W = 140, TRIM_H = 216; // mm: a poetry trim, tall enough for a sonnet's turnovers
const LEAD = 15; // pt: the body's leading, the grid every line of verse sits on
// #region answer: verse: a :::verse block keeps each line, its indent, the stanza breaks
// A poem is one :::verse block written as it is printed: a line of verse a line, a blank line
// between stanzas (one line of the grid), and spaces before an indented line, two to an em:
// :::verse{style="verse" align=start}
// The world is charged with the grandeur of God.
// It will flame out, like shining from shook foil;
//
// And for all this, nature is never spent;
// :::
// align=start sets the poem flush with the margin (the default centres it on its longest line).
const verse = {
id: 'verse',
hangingIndent: em(2), // a turnover hangs 2 em past its line's start: 4 em under a 2 em indent
// Verse keeps its words whole, even where bodyText.hyphenation.ragged is switched on.
hyphenation: false,
};
// Hook-up: paragraphStyles: [verse, …]; the Markdown goes to buildDocument as it is written.
// #endregion
The composed script.js runs as it is: paste it into any page’s module script, or open the recipe on CodePen. Recipe folder on GitHub ↗ (opens in a new tab)
Variations
#Hang the turnovers deeper
A deeper hanging indent sets the rest of a turned line further from the margin, for poems whose lines turn over often.
- hangingIndent: em(2), // a turnover hangs 2 em past its line's start: 4 em under a 2 em indent
+ hangingIndent: em(4), // a turnover hangs 2 em past its line's start: 4 em under a 2 em indent#Set the turnovers flush right
With turnover: 'right' in bodyText.verse, the rest of a line too long for the measure goes flush right on the line below, behind an opening bracket, as many English editions of poetry set it.
indentAfterHeading: false, minWordSpacing: 0.8, maxWordSpacing: 1.6,
+ verse: { turnover: 'right' }, // a turnover flush right, behind [
},#Open every poem on a right-hand page
With parity 'odd' each poem opens on the next recto. The book grows from eight pages to eleven, and the three blank versos print no folio, because the folios are filtered by page role.
const poems = { level: 1, numberingTemplate: '{1:I}', advancedDesign: poemHead,
- marginBottom: pt(0), breakBefore: { enabled: true, parity: 'any' } };
+ marginBottom: pt(0), breakBefore: { enabled: true, parity: 'odd' } };#Number the poems in figures
The template's counter style changes the numeral on the poem's page and in the contents at once.
-const poems = { level: 1, numberingTemplate: '{1:I}', advancedDesign: poemHead,
+const poems = { level: 1, numberingTemplate: '{1}', advancedDesign: poemHead,Pitfalls
Pitfall
'1998. ' or '- ' at a paragraph start opens a list
A paragraph that starts with a number, a period and a space, or with a hyphen and a space, becomes a list item. Put a word joiner (U+2060) before the number, and write dialogue with an em dash. Escapes and literal characters →
Pitfall
A heading style inherits its level's page break
A headingStyles entry takes every field it leaves out from its heading level, breakBefore included. A contents page or a colophon styled on an H1 after a :::pagebreak inherits parity 'odd' and lands behind a blank page. Give such a style breakBefore: { enabled: false }. Heading styles →
Pitfall
::resource{id="…"} takes double quotes only
A block embed is recognised only as ::resource{id="…"} with double quotes; any other form stays in the text as a visible line. Figures exactly here →
- Keep the lines of a stanza together: a blank line inside a
:::verseblock starts a new stanza, however many blank lines there are. - A line that starts with a plus sign and a space is a stepped line, set where the line above ended; write
\+to print the plus sign. - Without
align=starteach poem is centred on its longest line, and every poem then sits at a different distance from the margin. - To turn two words over together, tie them with a no-break space (U+00A0), as the soil and bright wings. are on page 5.
- A footer element with
pagesleft at'all'prints on blank pages too. The folio here is two elements, one for openers and one for body pages, so a blank verso stays blank.
Credits
- Recipe
- Ignacio Ferro
- Text
- “God’s Grandeur”, “The Windhover”, “Pied Beauty” and “Inversnaid”, with the places and dates from the editor’s notes, in the first edition of Poems of Gerard Manley Hopkins (1918); accents and indents checked against the proofread Wikisource transcription of that edition · Gerard Manley Hopkins; Robert Bridges (editor) · public domain
- The note on the text, the plate’s caption and the colophon · Ignacio Ferro · CC BY 4.0
- Images
- The frontispiece photogram of fern and rowan · Generated With Diffusion Models · original
- The rowan ornament, drawn in code in the page’s palette · Ignacio Ferro · CC BY 4.0
- Fonts
- Sorts Mill Goudy (SIL OFL 1.1) · Italiana (SIL OFL 1.1) · Marcellus SC (SIL OFL 1.1)
Edit this write-up ↗ (opens in a new tab)Recipe folder on GitHub ↗ (opens in a new tab)


