# Postext Cookbook

> Postext examples to copy, from a chapter opener to a whole book, each with the pages it sets and its full code.

- HTML version: https://postext.dev/en/cookbook
- Other languages: [es](https://postext.dev/es/cookbook.md)

Each recipe is a pen: one JavaScript module (with an HTML page and CSS when it needs them) that imports postext from esm.sh and builds its own page. Every link below is a recipe's Markdown rendition, which holds the write-up and the whole code.

## Part I · The page

### Chapter 1 · Page & grid

Trim sizes, mirrored margins, one, two and one-and-a-half columns, the baseline grid, flush columns and pages built to exact positions.

- [Nº 001 · Textbook with a margin column](https://postext.dev/en/cookbook/textbook-margin-column.md): A column-and-a-half page whose outer column holds only floats: span 'side' figures and glosses stack there, and captionSide moves the other captions into it. · Level 3 (Advanced) · Textbooks
- [Nº 013 · A book page on a baseline grid](https://postext.dev/en/cookbook/baseline-grid-book-page.md): A mirrored two-column page whose text block is exactly 44 leads tall, so the body text sits on one grid across the gutter and the spine. · Level 2 (Intermediate) · Any genre
- [Nº 027 · Newspaper front page](https://postext.dev/en/cookbook/newspaper-front-page.md): A local weekly's front page and page 2 in two ruled columns, with page-wide headlines set as boxes and a four-column strip of briefs floated to the foot. · Level 3 (Advanced) · Newspapers & newsletters
- [Nº 042 · Community newsletter: lead story and briefs](https://postext.dev/en/cookbook/community-newsletter.md): A two-page allotment newsletter in column and a half: the lead fills the wide column and jumps to page 2; column breaks send tagged briefs to the narrow one. · Level 2 (Intermediate) · Newspapers & newsletters
- [Nº 057 · One-page CV with a sidebar](https://postext.dev/en/cookbook/cv-with-sidebar.md): A one-page A4 CV whose plum sidebar is one box in a float-only left column, carried into the margins by header boxes, with job dates set flush right. · Level 2 (Intermediate) · Single sheets & ephemera
- [Nº 058 · Business letter to DIN 5008](https://postext.dev/en/cookbook/din-business-letter.md): A two-page German quotation on A4. The subject line is the H1, and its design pins the letterhead, the address and the information block at form B’s positions. · Level 2 (Intermediate) · Single sheets & ephemera
- [Nº 059 · Research poster on one big page](https://postext.dev/en/cookbook/research-poster.md): A 600 × 800 mm conference poster: a title band over one page-wide box with three columns of nested panels, a heat map keyed by swatches and −4.2 °C at 150 pt. · Level 3 (Advanced) · Papers & academic, Single sheets & ephemera

### Chapter 2 · Type & text

Justification and hyphenation per language, verse set line by line, paragraph styles, chips, superscripts, subscripts and maths.

- [Nº 002 · Two-column paper with numbered equations](https://postext.dev/en/cookbook/journal-article-with-maths.md): A two-column physics paper whose inline formulas and seven numbered equations are set by MathJax from the ?bundle build, and stay vector in the PDF. · Level 3 (Advanced) · Papers & academic
- [Nº 014 · Even word spacing in narrow justified columns](https://postext.dev/en/cookbook/justification-lab.md): Knuth–Plass breaking with word spaces held to 0.8–1.6 times normal, set beside a greedy control whose loose lines, lone lines and runts are marked from the VDT. · Level 3 (Advanced) · Magazines & zines
- [Nº 015 · Poems set line by line](https://postext.dev/en/cookbook/poetry-collection.md): Each line of verse is a paragraph whose turnovers hang 4 em in. Em spaces hold the 1918 indents, and :::space puts one line between stanzas. · Level 2 (Intermediate) · Poetry
- [Nº 016 · Justified Spanish in a pocket novel](https://postext.dev/en/cookbook/spanish-pocket-novel.md): The opening of Marianela’s chapter I as a pocket edition: Spanish hyphenation, word spaces under 1.7×, no runts, a raised initial and Figura 1 on the map. · Level 2 (Intermediate) · Fiction, drama & literary prose
- [Nº 028 · Lab report: formulas, subscripts and a titration curve](https://postext.dev/en/cookbook/lab-report-formulas.md): A four-page chemistry report on A4 that marks formulas and units in the text with ~ and ^ and keeps TeX for the reaction and the equations. · Level 3 (Advanced) · Reports
- [Nº 043 · Facing translation, stanza by stanza](https://postext.dev/en/cookbook/bilingual-facing-verse.md): Each poem is a frameless box with two columns: a fixed column break opens the English at its title, and :::space keeps each stanza level with its original. · Level 2 (Intermediate) · Poetry
- [Nº 044 · Critical edition: line numbers and line-keyed notes](https://postext.dev/en/cookbook/critical-edition-line-numbers.md): Milton’s Lycidas in the 1645 text: a script counts the lines and adds a side box after every fifth, and each note opens on its line number, set as a chip. · Level 3 (Advanced) · Poetry
- [Nº 060 · Early reader with syllable chips](https://postext.dev/en/cookbook/reading-primer-syllables.md): A Spanish primer unit for the letter M: syllables as chips in the colour of their vowel, and a grid of picture words with a drawing in each cell. · Level 2 (Intermediate) · Workbooks & exercises
- [Nº 061 · Screenplay format](https://postext.dev/en/cookbook/screenplay-format.md): A shooting script in Courier Prime 12 on US Letter, each speech a frameless callout padded to the dialogue block and each scene numbered in both margins. · Level 2 (Intermediate) · Any genre
- [Nº 062 · Shaped verse: Herbert’s Easter Wings, centred line by line](https://postext.dev/en/cookbook/shaped-verse.md): George Herbert’s Easter Wings and The Altar set as centred body text, a paragraph to each line of verse, so the lengths of the lines draw the two figures. · Level 1 (Basic) · Poetry

### Chapter 3 · Headings & openers

Band and photo openers, sunk and framed titles, side heads and hanging numbers, badges, datelines and one-off designed pages.

- [Nº 003 · Chapter opener on a full-bleed band](https://postext.dev/en/cookbook/chapter-opener-bleed-band.md): An advancedDesign opener on the level-1 heading: a bleed band, the chapter number on its foot, and a kicker and standfirst from the heading's attributes. · Level 3 (Advanced) · Textbooks
- [Nº 004 · Magazine feature: photo opener to end mark](https://postext.dev/en/cookbook/magazine-feature-opener.md): One advancedDesign opener sets a bleed photo and the heading's kicker, headline, standfirst and byline; two floated boxes and a chip end mark follow. · Level 3 (Advanced) · Magazines & zines
- [Nº 017 · Five chapter openers in one book](https://postext.dev/en/cookbook/five-chapter-openers.md): One opener on level 1 and four heading styles named in the Markdown; each style swaps the accent colour, and some also change the margins, columns or folios. · Level 3 (Advanced) · Any genre
- [Nº 018 · Section heads seven levels deep](https://postext.dev/en/cookbook/section-heads-field-manual.md): Sections numbered 1.1 to 1.12 in an amber pill that widens with its number, four more levels beneath them, and a seventh made with a heading style. · Level 2 (Intermediate) · Manuals, guides & reference
- [Nº 029 · Anchoring cheat sheet: a poster built from chained elements](https://postext.dev/en/cookbook/anchoring-cheat-sheet.md): An A3 lecture poster whose elements hang from the bleed, the page, their slot or one another, and a second sheet that frames each element and tags thirteen. · Level 2 (Intermediate) · Single sheets & ephemera
- [Nº 045 · Side heads, hanging numbers and run-in heads](https://postext.dev/en/cookbook/side-heads-hanging-numbers.md): A competition brief whose section titles stand in a margin channel on the text's baselines, with subsection numbers hung in the gutter and run-in heads in red. · Level 3 (Advanced) · Reports
- [Nº 063 · Certificate with a guilloche border](https://postext.dev/en/cookbook/certificate-single-page.md): End-of-course certificates drawn by one heading style: a guilloche frame in its header, a seal and signature lines in its footer, the name in its opener. · Level 2 (Intermediate) · Single sheets & ephemera
- [Nº 064 · Letters edition: datelines and signatures](https://postext.dev/en/cookbook/letters-edition.md): Letters run on without page breaks; each dateline comes from heading attributes, and paragraph styles set the salutation, the signature and a postscript. · Level 2 (Intermediate) · Fiction, drama & literary prose
- [Nº 065 · Pocket classic: short chapters that run on](https://postext.dev/en/cookbook/short-chapters-run-on.md): Dom Casmurro as a pocket book: short chapters run on under heads drawn in the column, and no page break strands a line or a head. · Level 2 (Intermediate) · Fiction, drama & literary prose
- [Nº 066 · Storybook chapters with vignettes and summaries](https://postext.dev/en/cookbook/storybook-chapter-vignettes.md): Each chapter heading names a style whose opener paints a vignette over the chapter line and Collodi's italic summary, taken from a heading attribute. · Level 2 (Intermediate) · Fiction, drama & literary prose

## Part II · The book

### Chapter 4 · Running heads & folios

Verso and recto heads, folios, filters by page role and parity, thumb tabs that move or change colour, and painted blank pages.

- [Nº 005 · Running heads by parity in a book of essays](https://postext.dev/en/cookbook/running-heads-by-parity.md): Header elements filtered by parity and page role: book title on versos, essay title cut short on rectos, folio tabs in the margin, a drop folio on openers. · Level 2 (Intermediate) · Fiction, drama & literary prose
- [Nº 046 · Dictionary with a moving thumb index](https://postext.dev/en/cookbook/dictionary-thumb-index.md): A loop makes one heading style per letter, and each style’s header prints that letter’s navy tab one step lower on the fore-edge, over a pale index. · Level 3 (Advanced) · Manuals, guides & reference
- [Nº 047 · Walking guide with thumb tabs](https://postext.dev/en/cookbook/walking-guide-thumb-tabs.md): A pocket guide with one heading style per walk, whose palette recolours the fore-edge tab, the stop numbers, the box’s tint and the blank verso before the walk. · Level 3 (Advanced) · Manuals, guides & reference

### Chapter 5 · Book structure

Covers, front matter, contents generated from the headings, parts in colour, back matter and books built chapter by chapter.

- [Nº 006 · Front matter in roman folios, then page 1](https://postext.dev/en/cookbook/front-matter-roman-to-arabic.md): The cover and prelims are unnumbered headings counted in lower-case roman; :::numbering restarts the count at 1 on the recto where the novel opens. · Level 3 (Advanced) · Fiction, drama & literary prose
- [Nº 007 · One book from separate chapters](https://postext.dev/en/cookbook/book-from-chapters.md): buildBundle sets five Markdown files as one book: each chapter opens on a recto, and page, chapter and figure numbers run on from file to file. · Level 3 (Advanced) · Manuals, guides & reference
- [Nº 019 · Parts in colour from one attribute](https://postext.dev/en/cookbook/parts-in-colour.md): A pocket field guide where each :::part sets one palette entry, and its divider, painted verso, thumb tabs, field marks and contents row print in that colour. · Level 3 (Advanced) · Manuals, guides & reference
- [Nº 030 · Anthology with bylines](https://postext.dev/en/cookbook/anthology-with-bylines.md): Three essays on walking whose headings carry author, year and magazine: the opener prints all three; the verso running heads and the contents print the author. · Level 2 (Intermediate) · Fiction, drama & literary prose
- [Nº 031 · Thesis back matter: appendix, glossary and index](https://postext.dev/en/cookbook/thesis-back-matter.md): The last pages of a thesis in black and white: a lettered appendix, a two-column glossary, APA references and an index whose page numbers the pen computes. · Level 3 (Advanced) · Papers & academic

### Chapter 6 · Boxes & notes

Callout families, boxes that split, float or stay pinned, margin glosses, stand-ins for footnotes, worksheets, recipe cards and code listings.

- [Nº 008 · A colour-coded family of textbook boxes](https://postext.dev/en/cookbook/textbook-box-family.md): Six kinds of textbook box in three colours, told apart by a stripe with an icon, a badge, a numbered tab, a strip of pictograms or a marker outside the frame. · Level 2 (Intermediate) · Textbooks
- [Nº 020 · Endnotes in two columns instead of footnotes](https://postext.dev/en/cookbook/endnotes-instead-of-footnotes.md): A short preprocessor turns Markdown footnotes into raised numbers and a Notes section, which a heading style sets on a page of its own in two columns. · Level 2 (Intermediate) · Papers & academic
- [Nº 021 · Boxes that split, float and pin](https://postext.dev/en/cookbook/boxes-split-float-pin.md): A lab worksheet in which the procedure box splits between two columns, the data sheet moves to the head of the next page and a badge is pinned to the foot. · Level 3 (Advanced) · Workbooks & exercises, Textbooks
- [Nº 022 · Worksheet with answer boxes and a word bank](https://postext.dev/en/cookbook/worksheet-answer-boxes.md): A four-page science worksheet: white answer boxes in pale green cards, 2 mm under each question and off the grid, with word banks and blanks made of chips. · Level 2 (Intermediate) · Workbooks & exercises
- [Nº 032 · Annotated classic with margin glosses](https://postext.dev/en/cookbook/annotated-classic-glosses.md): Alice’s mad tea-party as an annotated edition: green and red glosses in the outer margin, beside the lines they explain, each called by a letter in its colour. · Level 3 (Advanced) · Fiction, drama & literary prose
- [Nº 033 · Recipe card: ingredients beside the method](https://postext.dev/en/cookbook/recipe-card.md): Two cookbook pages with a white recipe card under a SERVES 4 tab: ingredients, tags and a checklist on the left, steps with 26 pt red numbers on the right. · Level 2 (Intermediate) · Manuals, guides & reference
- [Nº 048 · Code listings and keycaps without code blocks](https://postext.dev/en/cookbook/code-listings-and-keycaps.md): A shell guide whose fenced code becomes dark listing boxes before the build, with bold and italic runs as syntax colours and keys set as keycap chips. · Level 2 (Intermediate) · Manuals, guides & reference
- [Nº 049 · Exam paper with an answer sheet](https://postext.dev/en/cookbook/exam-paper.md): A four-page history exam on US Letter, with bubbles and marks drawn as chips, questions numbered 1, a), i) and answer lines ruled by a table. · Level 2 (Intermediate) · Workbooks & exercises
- [Nº 050 · Product manual with safety notices](https://postext.dev/en/cookbook/product-manual-warnings.md): A German kettle manual whose WARNUNG and VORSICHT boxes carry the warning triangle on a signal-coloured band, with German figure and table labels. · Level 2 (Intermediate) · Manuals, guides & reference

### Chapter 7 · Figures & images

Numbered figures that float to their citation, facing plates, maps and rotated overviews, full-bleed spreads and single-ink artwork.

- [Nº 009 · Figures that float to where you cite them](https://postext.dev/en/cookbook/figures-float-where-cited.md): A two-column chapter with seven numbered figures: six float from their first :ref to the first slot their placement allows; one sits where ::resource puts it. · Level 3 (Advanced) · Textbooks
- [Nº 034 · Catalogue entries facing their plates](https://postext.dev/en/cookbook/catalogue-facing-plates.md): Each entry opens a verso and cites its plate in the commentary’s first sentence; the plate floats to the facing recto, 221 mm tall at the scan’s proportions. · Level 3 (Advanced) · Catalogues
- [Nº 051 · Two-ink riso zine: art in one spot colour](https://postext.dev/en/cookbook/riso-zine-single-ink.md): A four-page zine for a two-drum risograph: full-colour drawings print as tints of the pink, recoloured by the pen for the canvas and by renderToPdf in the PDF. · Level 3 (Advanced) · Magazines & zines
- [Nº 067 · Atlas sheet: numbered maps and a rotated overview](https://postext.dev/en/cookbook/atlas-map-sheet.md): Maps with a numbering of their own and captions on a blue bar, a key of swatches in the maps' colours, and a sea chart turned sideways on page 3. · Level 3 (Advanced) · Manuals, guides & reference
- [Nº 068 · Photo essay with full-bleed plates](https://postext.dev/en/cookbook/photo-essay-full-bleed.md): Plates as heading styles built from a list, each filling its page to the trim; the storm plate runs across the gutter of a spread in two halves. · Level 2 (Intermediate) · Photobooks

### Chapter 8 · Tables

Tables built from data: merged headers, splits with a repeated header, fills and swatch keys, pictures in cells, calendars and grids.

- [Nº 010 · Datasheet: tables from data, merged headers](https://postext.dev/en/cookbook/technical-datasheet.md): Tables pasted as TSV, parsed with parseTSV and shaped with mergeCells, setAlignment and setCellBackground; a register map that splits across pages by itself. · Level 3 (Advanced) · Manuals, guides & reference
- [Nº 035 · Garden almanac: calendar grid and landscape chart](https://postext.dev/en/cookbook/garden-almanac.md): A 38-crop sowing chart set in landscape on two pages of its own, a calendar computed from dates and a companion matrix, their cells filled from the palette. · Level 3 (Advanced) · Manuals, guides & reference
- [Nº 036 · Mail-order catalogue with pictures in cells](https://postext.dev/en/cookbook/seed-catalogue.md): A seed catalogue whose price list is a table read from TSV, with a seed packet drawn in each variety's cell and the list split across a spread. · Level 3 (Advanced) · Catalogues
- [Nº 052 · Bistro menu: prices aligned without tab stops](https://postext.dev/en/cookbook/bistro-menu.md): A bistro menu printed on both sides, with the prices set in borderless tables and a brass rule anchored to either side of each course head. · Level 2 (Intermediate) · Single sheets & ephemera
- [Nº 053 · Conference programme with a merged schedule grid](https://postext.dev/en/cookbook/conference-programme.md): A two-day programme in schedule grids: mergeCells spans a plenary across the three rooms and a workshop over two slots, and each talk takes its track's colour. · Level 3 (Advanced) · Single sheets & ephemera
- [Nº 069 · Puzzle book: crossword, word search and maze](https://postext.dev/en/cookbook/puzzle-book.md): A crossword and a word search built as tables from lines of letters: black squares and found words are cell fills, clue numbers are superscripts. · Level 3 (Advanced) · Workbooks & exercises

## Part III · In practice

### Chapter 9 · Complete publications

Whole issues and editions, each using at least eight features on four pages or more.

- [Nº 023 · Magazine cover and sectioned contents](https://postext.dev/en/cookbook/magazine-cover-and-contents.md): A photo cover whose cover lines hang below the masthead, and contents generated with a coloured row per section. Each section is a part that opens no page. · Level 3 (Advanced) · Magazines & zines
- [Nº 037 · Annual report with flush columns](https://postext.dev/en/cookbook/annual-report-flush-columns.md): An energy co-op's annual report in two justified columns that end on the same grid line, with a key-figures box across the page and a closing page cut level. · Level 3 (Advanced) · Reports
- [Nº 038 · Trade paperback: sunk openers and recto chapters](https://postext.dev/en/cookbook/trade-paperback-novel.md): The Awakening as a 140 × 216 mm trade paperback: a drawn cover and a colophon with no running heads, then chapters sunk on rectos under an italic numeral. · Level 2 (Intermediate) · Fiction, drama & literary prose
- [Nº 070 · Play script: cast list, speakers and stage directions](https://postext.dev/en/cookbook/stage-play.md): The opening of Wilde’s play as an acting edition. Names print in bold plum and directions in grey italic; the cast list is read from tab-separated lines. · Level 2 (Intermediate) · Fiction, drama & literary prose

### Chapter 10 · Output & integration

From a Markdown string to canvas, HTML and PDF: fonts, print-ready and tagged PDFs, screen editions, bundles, workers, diagnostics and live rebuilds.

- [Nº 011 · One source, print and screen editions](https://postext.dev/en/cookbook/print-and-screen-editions.md): Both editions come from one config: htmlViewer.overrides holds the dark screen design, and applyHtmlViewerOverrides merges it in before each HTML build. · Level 3 (Advanced) · Magazines & zines
- [Nº 012 · From a Markdown string to a designed page](https://postext.dev/en/cookbook/first-page-from-markdown.md): A Markdown string with frontmatter is set as two-column magazine pages and painted on canvas, with six named colours in place of the default blue. · Level 2 (Intermediate) · Magazines & zines
- [Nº 024 · Print-ready PDF: bleed, crop marks and CMYK](https://postext.dev/en/cookbook/print-ready-pdf.md): An exhibition leaflet laid out with 3 mm of bleed and crop marks, exported as a CMYK PDF that takes its maps and floor plan from print masters. · Level 3 (Advanced) · Single sheets & ephemera
- [Nº 025 · A real PDF with the same fonts embedded](https://postext.dev/en/cookbook/pdf-with-embedded-fonts.md): A recital programme exported to PDF. Each face is fetched once, for FontFace and for the PDF, and each heading becomes a bookmark. · Level 2 (Intermediate) · Single sheets & ephemera
- [Nº 026 · Type specimen with every font loaded before layout](https://postext.dev/en/cookbook/fonts-before-layout.md): A four-page type specimen whose first build names every face its pages use; the pen loads them, clears the width cache and builds again. · Level 2 (Intermediate) · Catalogues
- [Nº 039 · Accessible tagged PDF (PDF/UA)](https://postext.dev/en/cookbook/accessible-tagged-pdf.md): A recycling guide exported as a tagged PDF/UA-1 file with alt text, table header cells, its language and linked contents; the preview draws the tags on page 3. · Level 2 (Intermediate) · Reports
- [Nº 040 · Brand fonts in layout, PDF and bundle](https://postext.dev/en/cookbook/brand-fonts-identity-manual.md): A fictional metro's identity manual set in the brand's own font files, fetched once and reused by the layout, the PDF's font provider and a .postext bundle. · Level 3 (Advanced) · Manuals, guides & reference
- [Nº 041 · .postext round trip in two languages](https://postext.dev/en/cookbook/bundle-round-trip.md): A two-sided DL leaflet written to a .postext file in code and laid out again from its bytes, with the faces, drawings and caption labels each edition carries. · Level 2 (Intermediate) · Single sheets & ephemera
- [Nº 054 · Retint a whole document from one palette](https://postext.dev/en/cookbook/live-palette-retint.md): Each colour in the config carries a palette id, so one function returns a fresh config that sets a festival programme in red, teal, violet or sand. · Level 2 (Intermediate) · Single sheets & ephemera
- [Nº 055 · A galley proof with every fault marked in red](https://postext.dev/en/cookbook/proof-sheet-diagnostics.md): A newspaper galley proofed twice, with every fault the engine reports or the pen finds itself marked in red on the page and linked to its Markdown. · Level 3 (Advanced) · Newspapers & newsletters
- [Nº 056 · Live editor with layout in a Web Worker](https://postext.dev/en/cookbook/web-worker-live-editor.md): Markdown beside a pocket page: a worker started from a blob sets the chapter with its own fonts, and each keystroke cancels the build in flight. · Level 3 (Advanced) · Fiction, drama & literary prose
