In short
A one-page CV for a book designer, with a coloured strip down the left side for contact details and skills. The dates of each job line up on the right.
What you'll build
The CV of Irene Salcedo, a fictional book designer in Madrid, on one A4 sheet. A plum band 66 mm wide runs down the left edge from the top of the sheet to its foot. At its head, a stack of cloth-bound books drawn in code stands level with the baseline of her name. Below it come her contact details, her skills and tools set as pills, her languages, education and teaching, and what she does outside work. Her name, in 46 pt Hedvig Letters Serif, heads a 118 mm text column with a five-line profile, three jobs and a list of the books she designed. Each job head puts the title on the left and the dates flush right on the same baseline, with the employer in italic below. The first sidebar title shares a baseline with the role under the name.
This recipe answers
- How do I make a column-and-a-half layout, with a wide text column and a narrow side column?
- How do I add a watermark, a background tint or a decorative image on every page?
- How do I make inline chips: keyboard keys, tags, word banks for exercises?
The short answer
const layout = {
layoutType: 'oneAndHalf',
sideColumnPercent: (SIDE / CONTENT) * 100, // 57 of the 185 mm between the margins
sideColumnSide: 'left',
sideColumnRole: 'floats', // no body text: only boxes fenced with span="side"
gutterWidth: mm(GUTTER), // the text column keeps 185 − 57 − 10 = 118 mm
};
// A side box stands where the text has reached at its fence, so the Markdown opens with it,
// before the name, and it starts at the head of the column (gotcha: side-box-starts-at-fence):
// :::callout{type="sidebar" span="side"}
// :::callout{type="section" title="Contact"} … ::: ← the sections nest inside it
// …
// :::space{lines=2.76} ← last: runs the band to the column's foot; a fifth of a line
// ::: more and the whole box moves to page 2
// # Irene Salcedo {role="Book designer and art director"}
const sidebar = { id: 'sidebar', background: col('band'),
// The first title stands on the role's line. The text starts 10 mm from the trim, the
// left margin plus 1 mm, and stops 10 mm short of the band's right edge.
padding: { top: mm(ROLE_Y), right: mm(10), bottom: pt(0), left: mm(1) },
body: { fontFamily: SANS, fontSize: pt(8.4), lineHeight: pt(12.4), color: col('paper'),
boldColor: col('paper'), paragraphSpacing: false } };
A float-only column on the left, filled by one box
Ingredients
- Features
- Margin column for floatsColumn and a halfMargin notesNested boxesCallout boxesExplicit vertical spaceInline chipsText, rules and boxes in page designsPictures in page designsAnchoring design elementsHeading levelsHeading attributesBullet lists and checklistsParagraph stylesSemantic colour palettePages on a canvas
- Type
- Hedvig Letters Serif, Hanken Grotesk (SIL OFL 1.1)
- Assets
- The stack of books at the head of the sidebar, drawn in code in the page's palette (Ignacio Ferro, CC BY 4.0)
Method
#1 · Nest the sections in one side box
// The sections nest in one side box. As separate side boxes they would stand at least a line
// of paper apart (gotcha: side-boxes-line-apart). A nested box ignores span and flows inside
// its parent (gotcha: nested-callout-limits).
const section = (id, lineHeight) => ({ id, backgroundEnabled: false, // the band shows through
padding: { top: pt(0), right: pt(0), bottom: pt(0), left: pt(0) },
marginTop: mm(10),
titleStyle: { ...caps('glow'), gap: mm(2.4) },
body: { ...sidebar.body, lineHeight: pt(lineHeight) } });
const chipStyles = [{ id: 'skill', fontFamily: SANS, fontSize: pt(7.6), bold: true,
background: col('chip'), color: col('paper'), borderWidth: pt(0),
borderRadius: em(1), // past half the chip's height: a pill
paddingX: em(0.6), paddingY: em(0.22), gap: em(0.3) }];
Inside the column, the band is the box from the short answer. Its fence comes before the name, so span="side" puts it at the head of the float-only column. The sections are boxes nested inside it, with no fill of their own, so the plum runs unbroken from Contact to Outside work. As separate side boxes they stand 4.7 to 9.1 mm apart, even with marginBottom at 0. The pills are about 3.9 mm tall. Skills and Tools use a section style of their own, chips, whose 16 pt leading leaves 1.8 mm between rows; the 12.4 pt of the other sections would leave half a millimetre (chip styles).
#2 · Paint the margins around the column
// Header elements are painted after the text, over it, so these stay in the margins, where
// no text runs (gotcha: header-paints-over-text). They repeat on every page.
const BAND_W = LEFT + SIDE; // mm from the trim edge to the band's right edge
const SEAM = 0.5; // mm of overlap with the box, so no hairline of paper shows between them
const REACH = 1; // mm the foot box climbs above the column's foot, over the end of the box
const bandBox = (id, x, y, w, h) => ({ kind: 'box', id, style: { backgroundColor: col('band') },
placement: { ...at('page', 'top-left', x, y), size: { width: mm(w), height: mm(h) } } });
const header = { elements: [
bandBox('head', 0, 0, BAND_W, TOP + SEAM), // above the column: the top margin
bandBox('edge', 0, 0, LEFT + SEAM, TRIM_H), // beside it: the left margin, top to bottom
bandBox('foot', 0, TRIM_H - BOTTOM - REACH, BAND_W, BOTTOM + REACH), // below it
// Painted last, over the box's top padding, where no text runs. The bottom of the stack
// sits on the name's baseline.
{ kind: 'image', id: 'books', resourceId: 'books', placement: {
...at('page', 'top-left', LEFT + 1, TOP + BASELINE - BOOKS.h),
size: { width: mm(BOOKS.w), height: mm(BOOKS.h) } } },
] };
The side column sits inside the page margins, so the sidebar box stops 9 mm short of the left edge and 18 mm short of the top. Three header boxes fill the top margin above the column, the left margin from top to foot and the bottom margin below the column. Header elements are painted after the text and on top of it, so the recipe keeps them in the margins, where no text runs. They also repeat on every page, and a second page would carry the band too (headers & footers). The top and left boxes overlap the sidebar box by 0.5 mm, and the foot box climbs 1 mm above the column's foot, over the end of the sidebar box, so no hairline of paper shows at the joins. The :::space that closes the sidebar box takes it down to 278.0 mm, 0.8 mm above the column's foot, with 2.76 lines in English and 1.76 in Spanish.
#3 · Set the name at the head of the text column
const nameplate = { enabled: true, slot: { elements: [
{ kind: 'text', id: 'name', content: '{titleText}', fontFamily: SERIF,
fontSize: pt(NAME.size), lineHeight: 1, color: col('ink'),
placement: at('container', 'top-left') },
{ kind: 'text', id: 'role', content: '{attr.role}', ...caps('accent'),
placement: at('#name', 'below', 0, NAME.gap) },
] } };
const nameLevel = { level: 1, // span stays 'column': the name heads the text column only
// No break before the name: the sidebar box is already on the page, and a break would
// move the name and the whole text column to page 2.
breakBefore: { enabled: false },
marginBottom: pt(LEAD), // one grid line of air under the role
advancedDesign: nameplate };
The H1 keeps the default span: 'column'. With 'page' it becomes an opener across both columns; set after the sidebar box, it moves to page 2, and there the side column starts under the name, 45.9 mm down. breakBefore is off because the sidebar box is already on the page: with a break, the name and the whole text column move to page 2. The level's marginBottom of one grid line starts the profile at 45.9 mm instead of 41.3 mm. The sidebar box's top padding is ROLE_Y, the name's height plus the gap under it, so the first sidebar title and the role share a baseline, 39.3 mm from the top edge.
#4 · Put the dates on the job title's line
const JOB = 9.8; // pt: the job title, the dates and the employer share the size and leading
const jobText = (id, content, look) => ({ kind: 'text', id, content, fontFamily: SANS,
fontSize: pt(JOB), lineHeight: LEAD / JOB, // the body's leading, as a multiple of the size
align: 'left', ...look }); // without align, design text is centred in its box
const job = { enabled: true, slot: { elements: [
jobText('title', '{titleText}', { fontWeight: 700, color: col('ink'), overflow: 'wrap',
placement: { ...at('container', 'top-left'), size: { width: mm(84) } } }), // clear of dates
jobText('dates', '{attr.dates}', { color: col('muted'),
placement: at('container', 'top-right') }), // the title's top and size, so its baseline
jobText('org', '{attr.org}', { italic: true, color: col('muted'),
placement: at('#title', 'below') }),
] } };
const jobLevel = { level: 3, fontSize: pt(JOB), lineHeight: pt(LEAD), marginTop: pt(9),
marginBottom: pt(0), advancedDesign: job };
// The section head takes 20 pt under 19.6 pt of space, three grid lines, so a job head
// starts the same 9 pt under a grid line after a section head as after a list. The 9 pt
// below it merge with a job head's 9 pt above. Under Selected books they push the list to
// the next grid line, as the default 7 pt would; with 0 it would start one line higher.
const sectionLevel = { level: 2, fontSize: pt(14), lineHeight: pt(20),
marginTop: pt(3 * LEAD - 20), marginBottom: pt(9), advancedDesign: sectionHead };
Each job is an H3 whose attributes carry the employer and the dates: ### Art director {org="Ediciones del Albardín, Madrid" dates="2021 – present"} (heading attributes). The title and the dates are anchored to the top of the same container, one to each corner, at the same size and leading, so they sit on one baseline. The title is held to 84 mm and set to wrap: a long one breaks onto a second line before it reaches the dates, and the employer moves down under it. With the space above it, each section head fills exactly three grid lines, which puts every job head 9 pt under a grid line whether it follows a section head or a list.
The whole recipe
// ═══ Postext Cookbook · Nº 057 · One-page CV with a sidebar ═══════════════════════
// https://postext.dev/en/cookbook/cv-with-sidebar
// Code: MIT · Text: original (CC BY 4.0) · Drawing: made in code (CC BY 4.0)
// Fonts: Hedvig Letters Serif, Hanken Grotesk (SIL OFL 1.1) · Needs postext ≥ 1.25.0
import {
buildDocumentWithFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';
const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'cv-with-sidebar';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
const palette = {
ink: '#231b22', // text: a plum-tinted near-black
band: '#3a2235', // the sidebar
accent: '#8f3b62', // on paper: the role and the section heads (7.1:1)
glow: '#f1b98f', // on the band: the sidebar titles (8.3:1)
chip: '#744d6c', // on the band: the skill chips
rule: '#d9cdd5', // the hairlines after the section heads
muted: '#6c5f69', // dates, employers, the colophon (6.0:1)
paper: '#ffffff', // the page, and the text on the band (14.4:1)
};
// Each colour carries its hex and the palette entry it follows.
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = Object.entries({ ...palette, 'main-color': palette.accent })
.map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } }));
const [SERIF, SANS] = ['Hedvig Letters Serif', 'Hanken Grotesk'];
const PT = 25.4 / 72; // mm in a point
const [TRIM_W, TRIM_H] = [210, 297]; // mm: A4, printed on one side, so nothing is mirrored
const [TOP, LEFT, RIGHT] = [18, 9, 16]; // mm
const LEAD = 13.2; // pt: the body leading
const BOTTOM = TRIM_H - TOP - 56 * LEAD * PT; // mm: the text block holds 56 lines
const CONTENT = TRIM_W - LEFT - RIGHT; // 185 mm between the margins
const [SIDE, GUTTER] = [57, 10]; // mm: the sidebar column, and the white after it
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });
const LABEL = 7.8; // pt: the role and the sidebar titles, tracked capitals
const caps = (colour) => ({ fontFamily: SANS, fontSize: pt(LABEL), fontWeight: 700,
textTransform: 'uppercase', letterSpacing: pt(LABEL * 0.18), color: col(colour) });
const NAME = { size: 46, gap: 2.6 }; // pt and mm: the name, and the room under it
const ROLE_Y = NAME.size * PT + NAME.gap; // mm under the top margin: the role's line
// mm under the top margin: the name's baseline. Hedvig Letters Serif, set solid, puts it 0.795
// of the size down the line (measured on the page); another face needs its own ratio.
const BASELINE = 0.795 * NAME.size * PT;
const BOOKS = { w: 46, h: 18 }; // mm: the drawing at the head of the band
// #region answer: a float-only column on the left, filled by one box
const layout = {
layoutType: 'oneAndHalf',
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
#Recolour the band
Each colour is written once, in palette, and the band boxes, the sidebar box, the chips, the role, the heads and the drawing take it from there. These three lines turn the band, the accent and the chips teal.
- band: '#3a2235', // the sidebar
+ band: '#1d3b3a', // the sidebar
- accent: '#8f3b62', // on paper: the role and the section heads (7.1:1)
+ accent: '#2b5f5b', // on paper: the role and the section heads (7.3:1)
- chip: '#744d6c', // on the band: the skill chips
+ chip: '#456d69', // on the band: the skill chips#Float figures into the same column
The textbook with a margin column puts figures, side captions and glosses in a float-only column on the outer edge of every page.
Pitfalls
Pitfall
A side box starts level with the block after its fence
In postext 1.4.1 a span: 'side' box stands in the side column at the height the text has reached at its fence, on the next grid line, and under any box already there. Fence a gloss just before the paragraph it explains: fenced after it, the gloss starts beside the next paragraph. A box that would run past the column's foot slides up until its foot sits on the column's foot, as far as the box above it allows; one that still does not fit waits for the side column of the next page. Margin notes →
Pitfall
Side boxes stacked in the channel keep a line of paper between them
In postext 1.4.1 a span: 'side' box leaves at least one body line under it before the next thing in the channel, rounded up to the baseline grid, whatever its marginBottom says. Boxes that share a background therefore never touch: stacked, they read as separate cards. For one continuous panel, fence a single side box and nest the sections inside it. Margin notes →
Pitfall
:::space is dropped at the top of a box or column
:::space is dropped at the top of a column, of a :::columns group, of an untitled box that has other content and of the continuation of a split box. Since postext 1.5 a box made only of :::space is as tall as the space asks (an answer box, room to write), and space right under a box's title opens the body that much lower. To open an untitled box with space, give it a title or a first line and add the space after it. Explicit vertical space →
Pitfall
Header and footer elements paint over text
Header and footer elements are painted over the page and the text area does not make room for them. Keep them within the margins, which are what reserve their space. Running heads and folios →
Pitfall
A nested box ignores span, placement and snapToGrid
A callout nested in another ignores its span, placement, snapToGrid and floatBarrier: it always flows inside its parent, at the parent's inner width. Nested boxes →
- Fit the
:::spaceto the page. In the English edition 2.76 lines end the box 0.8 mm above the column's foot. At 2.96 lines it runs 0.1 mm past the foot and the whole sidebar moves to page 2; at 2.66 a strip of paper opens between the box and the foot box. - A box in the name's design is no way to paint the band. The heading reserves the box's height, so a box as tall as the band makes it reserve more than the column's 260.8 mm, and the text moves to page 2. With
reserve: falsethe box reserves nothing, but a design in the column is cut at the column's foot, and the bottom margin would stay white.
Credits
- Recipe
- Ignacio Ferro
- Text
- Original prose, CC BY 4.0
- Images
- The stack of books at the head of the sidebar, drawn in code in the page's palette · Ignacio Ferro · CC BY 4.0
- Fonts
- Hedvig Letters Serif (SIL OFL 1.1) · Hanken Grotesk (SIL OFL 1.1)
Edit this write-up ↗ (opens in a new tab)Recipe folder on GitHub ↗ (opens in a new tab)


