Chapter 3.15 · Part II · The craft
Configuration: composed pages
Page templates for composed pages: frames, groups, grids that repeat a frame set, modules, decoration and connectors, inheritance and recto/verso variants, the label styles of picture anchors, and the warnings a template can give
In short
This page covers page templates. A template is a page drawn in the settings: named boxes called frames, where each one sits, how big it may grow and how it looks. The Markdown of a composed page then fills the frames by name, so the text never holds positions and the settings never hold text. A template can start from another one and change only a few frames, and it can differ on left and right pages. The page also lists the label styles for words set on pictures, and every warning a template can give with the way to fix it.
#Page templates
A composed page is a page whose form comes from a template in the configuration and whose content comes from the Markdown of a page fence, the ::::page{template="…"} block that opens with four colons. The template names rectangles, called frames; the Markdown sends each piece of content to a frame by its name (its slot). Geometry never appears in the Markdown, and content text never appears in the template. The pageTemplates property holds the templates of the book:
const config: PostextConfig = {
calloutStyles: [{ id: 'caja-azul' }, { id: 'tab-titulo' }],
pageTemplates: [
{
id: 'tema-cajas',
decoration: {
elements: [
{ kind: 'image', id: 'fondo', resourceId: '{attr.fondo}', decorative: true,
placement: { anchor: { to: 'bleed', edge: 'top-left' }, size: { width: 'fill', height: 'fill' } } },
],
},
frames: [
{ name: 'titulo', takes: 'h1', style: 'tab-titulo' },
{ name: 'texto', flow: true },
{ name: 'dinero', style: 'caja-azul', padding: { right: { value: 62, unit: 'mm' } } },
{ name: 'dinero-fotos', layer: 2, width: { value: 60, unit: 'mm' },
placement: { anchor: { to: '#dinero', edge: 'top-right' } } },
],
groups: [
{ name: 'pagina', kind: 'stack', gap: { value: 6, unit: 'mm' }, frames: ['titulo', 'texto', 'dinero'] },
],
},
],
};A template that sets nothing but its id and one frame is a whole page with that frame filling the content area. Every other field is optional:
| Property | Type | Default | Description |
|---|---|---|---|
id | string | required | The name a page fence asks for (template="tema-cajas"). Unique among the templates: a second one with the same id is ignored. |
name | string | the id | The name shown in the Sandbox. Layout never reads it. |
extends | string | none | The id of a template this one starts from. See Inheritance and variants. |
area | 'content' | 'trim' | 'bleed' | 'content' | The rectangle that frame positions refer to. 'content' is the page's content area, mirrored on left and right pages like the running text; 'trim' is the trimmed page; 'bleed' the page with its bleed. |
grid | { columns, rows, columnGap?, rowGap? } | none | Divides the area into cells, so a frame or a group can be placed by cell (grid: { col: 2, row: 1, cols: 2 }, 1-based) instead of by placement. The gaps default to 0. |
frames | FrameConfig[] | [] | The frames, in template order: the order in which they are measured, which also breaks ties. See Frames. |
groups | FrameGroupConfig[] | [] | Stacks and rows of frames that share space. See Groups. |
decoration | DesignSlot | none | Images, rules and boxes painted with the page, written with the same elements as headers and footers. Text elements hold placeholders only ({pageNumber}, {chapterTitle}, {attr.x} for an attribute of the page fence). An element may anchor to a frame or a group ('#dinero') and then moves with it. Decoration is laid after the frames and never pushes text. Since postext 1.42, {headingNumber} prints the counter of the first numbered heading the page's frames hold (a frame with takes) and {headingNumber.titulo} that of the frame titulo, in the document's digits, so a badge with a topic's number reads it from the heading and the page fence need not repeat it. Decoration is painted under the frames; a click on a text element that lies over a frame, at a point where the frame has no text of its own, reaches the element, not the frame. A frame with a negative layer is painted under the decoration. Since postext 1.48 the decoration also takes path elements (bars, ribbons, chevrons drawn as vector shapes) and connectors, the lines that join frames. |
header, footer | DesignSlot | false | inherited | The running head and the folio of the page. Unset, the page keeps those of its chapter; false hides them. |
spread | boolean | false | The template describes two facing pages laid as one sheet (see Composed pages › Spreads). A spread starts on a verso, the left page of a left-to-right book and the right page of a right-to-left one, with a blank page before it when needed. Its page fence carries the spread flag too; when they disagree the template decides (spreadMismatch). |
gutter | Dimension | 0 | On a spread, the width of a band centred on the spine that frames keep out of unless they set crossGutter: true: a frame reaching across it is cut at the band's edge on the side where the frame's centre lies, and a frame starting inside it moves out. With 0 the band is the spine itself. |
variants | { recto?, verso? } | none | Changes for a right page (recto) or a left page (verso), written like the template itself. The side is the physical one, so left-to-right and right-to-left books both work. |
overflowTemplate | string | this template | The template of the pages added when a frame continues on the next page (overflow.). Unset, the added page is this template laid again with only the continued frames filled; the others take no room. A spread here makes the continuation a spread. See Composed pages › When the text continues. |
bodyStyle | string | none | A paragraph style for the text of the page, as heading styles have one. The layout does not apply it yet. |
palette | string | none | A palette override for the page, as heading styles and parts have: pairs entry=#hex separated by commas (tint=#f6c3d0). Every colour of the page's frames and decoration that is linked to that palette entry (or equals its value) takes it, and the page fence's palette attribute goes on top. Since postext 1.42 the value is applied; before, it was read and ignored. |
role | string | 'composed' | The page role that design elements with a pages filter see. 'module' makes the template a module: a box of frames that pages stack in a group instead of a page of its own (see Modules). Since postext 1.48. |
width | Dimension | { percent } | 'fill' | 'fill' | A module: its width in a modules row or stack, as a length, a percentage of the group's width, or 'fill', an equal share of what the row's other modules leave. In a grid the module takes its column. Since postext 1.50. |
grow | number | 0 · 'fill': 1 | A module: its share of the room a modules row leaves past its modules' widths; a 'fill' module takes 1 at least. Since postext 1.51. |
shrink | number | 0 | A module with a width: how much width it gives back, by its width, when a modules row runs past the group's end. Since postext 1.51. |
#Frames
A frame is a named rectangle that receives typeset content. Its name is the slot the Markdown asks for, and it is unique in its template (a group cannot take the name of a frame either, since anchors name both the same way).
A frame is placed by its grid cell when the template has a grid, else by its placement, which works like a design element's: an anchor ('container' is the area, 'page', 'bleed', or '#name' for another frame or group), an edge, an offset and a size. A frame anchored to another one moves with it. Without either, the frame starts at the top-left corner of the area, as wide as the area, and as tall as its height rule says. How the content is poured into the frames, chained and clipped is described in Composed pages › How the page is set.
| Property | Type | Default | Description |
|---|---|---|---|
name | string | required | The slot name. |
placement | ElementPlacement | the whole area | Anchor, edge, offset and size, as in element placement. Ignored when a grid cell places the frame. |
grid | { col, row, cols?, rows? } | none | A cell of the template grid, 1-based, spanning cols × rows cells (default 1). A cell past the grid is moved back inside it. Ignored when the template has no grid. |
width, height | Dimension | { percent } | 'auto' | 'fill' | 'fill', 'auto' | A fixed length, a percentage of the area (0 to 100), 'auto' (the content's own size) or 'fill' (what is left up to the edge the frame is anchored to). Unset, the frame reads placement.size, then the default: full width, as tall as its content. Since postext 1.42, an 'auto' width makes the frame as wide as its longest line plus its padding, no wider than the room its anchor leaves or than maxWidth (text that does not fit wraps there), no narrower than minWidth. The text is measured set flush left, so a centred title is as wide as its words. The frame starts at the edge its anchor names, and frames anchored to it follow. Use it for a tab or a box that has to match its title in every language. A value the engine cannot use (a negative length, an unknown unit) reads as the default. |
minWidth, maxWidth, minHeight, maxHeight | Dimension | none | Limits for an 'auto' or 'fill' size and for the space a group gives or takes. The minimum wins over the maximum, and a fixed size outside them is brought between them (frameMinMax warns of both). |
style | string | frameless | A callout style id: frames are drawn with callout styles (background, border, padding, stripe, icon, label tab, title). The words of a tab come from the Markdown (:::frame{slot="dinero" label="El dinero"}). The callout settings about where a box goes in the running text (placement, span, columns, width, fixed…) do not apply to a frame. |
padding | { top?, right?, bottom?, left? } | the style's | Overrides the style's padding side by side: room for the photos that sit over a box, for example. |
layer | number | 1 | Paint order. Decoration is layer 0; a negative layer paints below it. |
rotate | number | 0 | Degrees, clockwise. The box and its content turn together. |
verticalAlign | 'top' | 'middle' | 'bottom' | 'justify' | 'top' | Where the content sits in a frame taller than it. |
columns, columnGap | number, Dimension | 1, the style's | Columns inside the frame. A heading never ends one of them: it goes on to the next column with the text it introduces (under headings.keepWithNext, since postext 1.46). |
exclude | 'none' | 'push' | 'none' | 'push': the text of other frames wraps around this one's rectangle. |
wrap | 'box' | 'contour' | 'box' | With exclude: 'push': what the text of the other frames wraps around. 'contour' is the shape of the pictures the frame holds (their polygon or alpha channel, see Contour wrap); a turned frame, or one whose pictures have no known shape, pushes with its box. |
flow | boolean | false | The frame receives the content that names no slot. |
takes | 'h1' … 'h6', 'toc' | none | The frame receives the first heading of that level that names no slot, so a page title is # Title atop the fence. With 'toc' it receives the :::toc of the page that names no slot and sets it by the rules of the contents (since postext 1.42; see Composed pages). |
next | string | none | A chain: content that does not fit continues in the frame of that name, on the same page. |
overflow.continueIn | string | none | Where content that does not fit goes on: '#frame' (another frame of the page, as next), 'next-page' (the same frame on a page added after this one, from overflowTemplate), 'template:<id>' (a page of that template: its frame of the same name, else its flow frame) or 'page:<id>' (a frame of the later page fence ::::page{id=…}: the one 'page:<id>#<frame>' names, else one that its own content leaves empty; <id> may be {attr.name}, read from the page fence; see Composed pages › Jumping to a later page). A frame of an added page with no rule of its own goes on with the rule that brought the content (after a jump, 'next-page'), up to 16 added pages. The page may be in a later chapter file of the book (since postext 1.41). |
overflow.mark | string | false | the language's | The mark at the end of a piece cut for another page. Unset, the frame style's continuesMarker, which follows the document language («Continued», «Continúa», «À suivre»…, the words split tables use); a string sets those words, {page} in it being the number of the page where the rest goes on; false sets none. A frame chained with next on the same page carries no mark. |
overflow.fromMark | string | none | Words set at the head of the piece on the page where the content goes on, {page} being the number of the page it comes from ("Continued from page {page}"). The receiving frame's own wins over the sending frame's. |
fit.shrinkText | boolean | true | When nothing else makes the content fit, its text may be set smaller, in steps of 2.5 % (see When content does not fit). |
fit.minScale | number | 0.9 | The smallest text scale, above 0 and at most 1 (a larger value reads as 1). Font size, leading and spacing scale together. |
fit.scaleImages, fit.imageMinScale | boolean, number | true, 0.8 | Whether the pictures in the frame and in the other frames of its group may be set smaller when this frame's content does not fit, and down to what scale. |
fit.preferContinue | boolean | true | A frame whose overflow.continueIn sends content to another page goes on there before its pictures and text are set smaller, so a story keeps one size from page to page. false: they shrink first, and the frame goes on only when that is not enough. |
pin | boolean | false | The frame never moves or resizes, for a box that must stay aligned with the artwork. A group flows around it. |
grow, shrink, priority | number | 0 | How the frame shares the space of its group: grow takes a share of the spare space, shrink lets the frame give space back, and frames with a lower priority give it first. |
growWith | 'children' | string[] | — | Grows with its inner frames (Composed-page books, step 6). |
optional | boolean | false | No warning when the Markdown sends nothing to the frame. |
crossGutter | boolean | false | On a spread, the frame may run across the spine band. Its text is read on the page that holds its centre; the facing page paints its half. |
rules | { every?, color?, width?, inset? } | — | Ruled lines across the frame's content box: one at the foot of each line slot, as many as its height holds. every is the pitch, 'line' (the default: the leading of the frame's text) or a length; color is a mid grey by default, width the thickness (0.5 pt), inset the room left at both ends of each rule, or { left, right }. See Ruled frames below. Since postext 1.38. |
look | { background?, border?, stripe?, icon?, marker?, titleStyle?, body?, label? } | — | The parts of its callout style's look that this frame changes, with the style's own names and nesting: colours (background, border.color, stripe.color, icon.color, marker.color and marker.rule.color, titleStyle.color, body.color, body.boldColor, body.italicColor, label.color, label.background, label.rule.color) and the tracking of the text (body.letterSpacing). A background also turns the style's fill on; a tab colour only applies to a style that has a tab. In a child template it merges key by key over the frame it overrides. A book with one box shape in several tints keeps one style and writes the tint here, or lets palette recolour a palette-linked fill. A piece of the page can lay a named look over it (see Frame looks). Since postext 1.42. |
writingMode, direction | 'horizontal-tb' | 'vertical-rl', 'ltr' | 'rtl' | the page's | A frame set in its own writing mode or direction: a vertical box on a horizontal page, a horizontal card on a vertical one, a right-to-left quotation in a left-to-right book. A frame of the other writing mode is laid out in its box turned a quarter turn: its lines run along the box's height and follow each other across its width, and an 'auto' height is the least that holds them in that width. Its text is painted as a page of that mode paints its own. direction sets the frame's story in that direction, as a box fenced {dir=…} is; a block or box that writes its own dir keeps it. Since postext 1.39. Since postext 1.40 a vertical frame also works on a right-to-left page, laid out as on a left-to-right one and placed where the mirrored flow puts it, its text painted unmirrored; a picture in a vertical frame of a horizontal page stands upright with its caption and takes the room the box has left across the page; the reflowable EPUB writes a frame of another writing mode as a box with that mode and the length its lines run along (in ems of the body text). Since postext 1.42 a picture in a frame of a vertical page that follows the page's own mode stands upright with its caption in the same way. |
overlap | 'check' | 'allow' | 'check' | 'allow' leaves the frame out of the overlap checks: frameCovered is not raised for a pair it belongs to, whether it is painted over the other frame or under it, and frameOutsideArea is not raised for it. For art meant to sit over text, or a badge hung half off its card on purpose. See Overlap, repeat and module warnings. Since postext 1.48. |
remove | boolean | false | In a template that extends another, or in a variant: drop the inherited frame of that name. |
Ruled frames. An answer space in an activity book is a frame with rules: its lines follow its height, so the Markdown decides how many there are. An empty frame with a fixed height gets the lines that fit it; an 'auto' frame that receives :::space{lines=4} gets four, and a frame that grows with its text gets more. The rules are drawn over the frame's background and under its text, on canvas, in the HTML, the PDF and the fixed-layout EPUB; the Sandbox's frame inspector turns them on under Look.
frames: [
{ name: 'pregunta', style: 'actividad' },
{ name: 'respuesta', rules: { color: { hex: '#93bcd8', model: 'hex' }, width: { value: 0.75, unit: 'pt' } } },
],
groups: [{ name: 'actividad', kind: 'stack', gap: { value: 3, unit: 'mm' }, frames: ['pregunta', 'respuesta'] }],:::frame{slot="respuesta"}
:::space{lines=4}
:::#Groups
A group is a stack (top to bottom) or a row (start to end) of frames that share space and move together. Inside a group, the frames' own position along the group's direction is ignored: the group lays them out in order, with gap between them. When the text of one frame grows, the frames after it move along. A group is a box that frames and decoration can anchor to ('#pagina').
| Property | Type | Default | Description |
|---|---|---|---|
name | string | required | Unique among the frames and groups of the template. |
kind | 'stack' | 'row' | 'grid' | 'stack' | Top to bottom, start to end, or cells in rows ('grid', since postext 1.48; see Grids that repeat a frame set). |
frames | string[] | [] | The frames of the group, in their order on the page. A frame belongs to one group at most; a name that is not a frame of the template, or a frame already listed, is skipped. A grid that repeats takes the frames of repeat.frames instead. |
columns | number | 1 | A grid: the number of columns, all of one width. |
columnGap, rowGap | Dimension | the group's gap | A grid: the room between two columns, and between two rows. |
rowAlign | 'start' | 'center' | 'end' | 'stretch' | 'stretch' | A grid: where a cell shorter than its row sits. 'stretch' makes its main frame as tall as the row (up to its maxHeight), when that frame's height is 'auto' or 'fill'. A modules row or grid: where a shorter module sits; 'stretch' lays it in a box as tall as the row, so its ground and its 'fill' frames reach the row's foot. Since postext 1.51 also its 'auto' frames ending at its foot, but not one as wide as its content. |
repeat | { frames, max? } | none | A grid: the frame set laid once per item of the page's content. The first frame of frames is the cell's main frame; max caps the items, and the rest goes to the flow frame (repeatOverflow). |
modules | boolean | false | The group takes the page's :::module blocks in Markdown order, gap between them: one under another ('stack'), side by side ('row') or in columns ('grid', since postext 1.50). Its frames are not read. See Modules. Since postext 1.48. |
overflow.continueIn | 'next-page' | 'template:<id>' | none | A modules group: where a module that does not fit goes on, whole. Unset, the module is cut at the group's foot and its frames climb the reflow ladder. |
within | string | none | A modules group inside the modules group of this name (to any depth since postext 1.51): each run of modules it takes is laid where its first module comes, as rows of a stack or one cell of a row or a grid. Since postext 1.50. |
templates | string[] | none | A modules group within another: the module templates it takes. Unset, every module, or only its inner groups' when it has some. A module goes to the first group that takes it, else to the page's modules group. |
gap | Dimension | 0 | The room between two frames of the group. |
placement, grid | as frames | its frames' box | The group's own box. Unset, the group starts where its first frame is placed and runs as far as its frames need. |
align | 'start' | 'center' | 'end' | 'space-between' | 'start' | Where the spare space goes when no frame of the group grows. |
remove | boolean | false | In a template that extends another, or in a variant: drop the inherited group. |
#How groups share space
A frame declares its size: a fixed height, or 'auto', the height of what it holds, kept between minHeight and maxHeight. For a template drawn from a printed page, give each box the height it has on the page as minHeight: a short text keeps the drawn box, a longer one makes it taller. The page is laid out twice in the same pass, once as the template declares it and once as its content needs, and what differs between the two is the reflow log.
Stack. The frames of a stack go one under another at their heights, gap between them. Each keeps its own horizontal place and width; its own vertical place is ignored.
- A group with no
placementorgridof its own starts where its first frame is placed (itsplacement, or itsgridcell in a template with a grid) and runs down as far as its frames need, to the foot of the template's area. When one frame grows, the frames after it move down by as much. - A group with a box of its own lays its frames inside that box. When they need more than it holds, the frames with
shrinkabove 0 give space back, the lowestpriorityfirst; frames of the same priority give in proportion to theirshrink; none goes below itsminHeight. Spare space goes to the frames withgrowabove 0, in proportion to it, up to theirmaxHeight; with none,alignplaces the frames ('end'at the foot,'center','space-between'). A frame of the group with no placement of its own takes the group's box as its area. - When nothing more can give, the frames nearest the group's foot give way first, each down to its
minHeight; a frame with a fixed height keeps it, so an empty answer space or picture slot under a box that grows stays on the page and the box's own text gives way instead. No frame runs past the group's foot: the frame whose content does not fit climbs the reflow ladder (see When content does not fit), and what still does not fit is cut there and reported asframeOverflow. A frame cut below itsminHeightor its fixed height is reported too, whether it holds content or not. - A frame with
height: 'fill'asks for itsminHeightand takes spare space as if it hadgrow: 1.
Row. The frames of a row go side by side at their declared widths, all as tall as the row: the height of the group's box, or, with no box of its own, the tallest height its frames set: a fixed height, else a minHeight (an 'auto' frame sets nothing more), or, when they set none, the height of the tallest content (a frame with a fixed height keeps its own). When the text of one frame runs past the row's height, the frame takes width: first the spare width of the row, then width from siblings with shrink above 0, the lowest priority first, each one never narrower than the width its own text still fits in. The width taken is the fewest whole millimetres that make the text fit; if even all the room there is would not, the frame takes none, and a row with no box of its own grows taller instead. Cards with height: 'auto' and a minHeight thus share width at that height, and the row grows only when no card has width to give. Spare width goes to the frames with grow above 0, then to align. Rows run from left to right.
Pins. A frame with pin: true keeps the box the template declares for it, even when the frame it is anchored to grows or moves: a box drawn to match the artwork stays on it. In a group, a pinned frame holds its place and the other frames go past it, gap kept on both sides; a pinned frame outside the group does the same for the group's frames it would overlap.
Decoration. A decoration element anchored to a frame (anchor: { to: '#dinero' }) moves with the frame when the frame grows or moves. An element with pin: true stays where the template draws that frame.
| Property | Type | Default | Description |
|---|---|---|---|
pin (decoration element) | boolean | false | On a composed page's decoration: an element anchored to a frame stays where the template puts that frame, whatever the frame's content or group does. Ignored on headers, footers and heading designs. |
The three boxes of a textbook page, each at the height it is drawn and growing with its text:
frames: [
{ name: 'dinero', style: 'caja-azul', width: { value: 186, unit: 'mm' }, minHeight: { value: 36, unit: 'mm' },
placement: { anchor: { to: '#texto', edge: 'below' }, offset: { y: { value: 9, unit: 'mm' } } } },
{ name: 'dinero-fotos', layer: 2, width: { value: 58, unit: 'mm' },
placement: { anchor: { to: '#dinero', edge: 'top-right' } } },
{ name: 'gasto', style: 'caja-verde', width: { value: 186, unit: 'mm' }, minHeight: { value: 62, unit: 'mm' } },
{ name: 'ahorro', style: 'caja-amarilla', width: { value: 186, unit: 'mm' }, minHeight: { value: 30, unit: 'mm' } },
],
groups: [{ name: 'cajas', kind: 'stack', frames: ['dinero', 'gasto', 'ahorro'], gap: { value: 12, unit: 'mm' } }],The result depends only on the page's content, the template and the typography: the same input gives the same page, measured in the same order with the same steps. The negotiation never reads another page, so a change on one composed page leaves every other page as it was, as long as the content stays on its page.
Holding frames at the foot of a card (since postext 1.42). A frame anchored below the text above it follows that text: in an edition where the text is a line shorter or longer, the frames under it move up or down, while what the template draws (a card, a band, the foot) stays where it is. To keep frames at the foot of a card, where the template puts them, make the card's frames one stack with a box of the card's height. The frames above the held ones take the spare space (grow: 1) and give it back (shrink: 1); the held ones set a minHeight. A shorter text leaves the held frames where they were. A longer one is squeezed above them: they keep their minHeight, the text above is scaled down and, if it still does not fit, the layout reports frameOverflow and the reflow log lists textScaled and overflow for the frame above. A frame anchored to the container's foot (bottom-left) holds its place too, but nothing links it to the frames above it: a longer text runs over it, nothing is squeezed for it and the overlap is not reported.
{
"frames": [
{ "name": "texto", "grow": 1, "shrink": 1 },
{ "name": "mapa", "minHeight": { "value": 60, "unit": "mm" } }
],
"groups": [{
"name": "tarjeta", "frames": ["texto", "mapa"], "gap": { "value": 4, "unit": "mm" },
"placement": {
"anchor": { "to": "container", "edge": "top-left" },
"size": { "width": "fill", "height": { "value": 140, "unit": "mm" } }
}
}]
}The frame that grows is as tall as the room, whatever it holds, so a style with a visible background would paint all of it: paint the card in the template's decoration and leave the text frame without a style.
#Grids that repeat a frame set
A page of photo cards, a page of activity cards or a page of portraits with a name under each one is the same card drawn many times. A grid group with repeat draws it once in the template: the frames of one card, called the frame set, which the grid lays once per item the page's Markdown gives it. How many cards a page has is then up to the Markdown, and a translation that adds a card needs no new template. Since postext 1.48.
frames: [
{ name: 'titulo', takes: 'h1' },
{ name: 'foto', style: 'marco', placement: { anchor: { to: '#titulo', edge: 'below' }, offset: { y: { value: 6, unit: 'mm' } } } },
{ name: 'pie', style: 'pastilla', width: 'auto', layer: 2, overlap: 'allow',
placement: { anchor: { to: '#foto', edge: 'bottom' }, offset: { y: { value: 4, unit: 'mm' } } } },
],
groups: [{
name: 'fotos', kind: 'grid', columns: 3,
columnGap: { value: 6, unit: 'mm' }, rowGap: { value: 10, unit: 'mm' },
repeat: { frames: ['foto', 'pie'] },
}],- The set. The first frame of
repeat.framesis the cell's main frame: it takes the cell's width and keeps its own height rule ('auto'is the height of its content, betweenminHeightandmaxHeight). The other frames of the set are laid as the template draws them, anchored to the main frame or to each other: here the caption pill hangs from the foot of the photo. A frame of the set anchored to a frame outside it stays where that anchor puts it. - Items. Each
:::frame{slot="foto"}piece of the page is one item: pieces of a repeated slot are not joined. Inside the piece, a block that names a member of the set (:::frame{slot="pie"},::resource{… slot="pie"}) goes to that member of the same card; the rest goes to the main frame. See Composed pages › Repeated slots. - Instances. Each card's frames are named
<frame>[n], counted from 1:foto[2]andpie[2]are the second card. Warnings, the reflow log, the source map and the Sandbox use these names, the frame ids arecp<n>:foto[2], and a decoration element or a connector can anchor to'#foto[2]'. A connector'sto: '#foto[*]'reaches every card the page has. An element anchored to'#foto'reads the grid's box. - Cells. Cells fill the rows from the start side, so on a right-to-left page the first card is on the right. A row is as tall as its tallest cell, counting what hangs above the main frame (a tab) and below it (a pill);
rowAlignplaces the shorter ones. The grid's box is its ownplacementorgridcell; without one it starts where the template draws the main frame and runs to the right edge and the foot of the area. - When the cards do not fit. A row past the grid's foot is cut there, each card climbs the reflow ladder on its own, and the last card cut reports
frameOverflow. Withoverflow.continueInon the main frame ('next-page','template:<id>'), the grid goes on by whole rows: the first row that does not fit, and every row after it, are laid on the added page, in the grid of a template that repeats the same frame set. A cell taller than the whole grid warns instead of going on for ever. max. The items pastrepeat.maxgo to the flow frame, or after the page when the template has none, and each one raisesrepeatOverflow.
A grid without repeat lays the frames it lists, one per cell, in the order written. A frame of a repeated set listed in another group is skipped there (groupFrameTwice), and a name the template does not have is groupFrameUnknown. grow and shrink do not apply to the rows of a grid, nor redistribute to its cards.
#Modules
A textbook page often stacks blocks that recur across the book in another order: a box with a photo beside it, a tree of three ideas, a grid of four photos under a heading. Drawing a template for each order multiplies templates. A module is one of those blocks drawn once: a template with role: 'module', holding frames, groups and decoration (connectors included), and no page of its own. A page template takes modules in a group with modules: true; the page's Markdown says which modules it holds and in what order (see Composed pages › Modules in a page). Since postext 1.48.
pageTemplates: [
{ id: 'tema', frames: [{ name: 'titulo', takes: 'h1' }],
groups: [{ name: 'cuerpo', modules: true, gap: { value: 8, unit: 'mm' },
placement: { anchor: { to: '#titulo', edge: 'below' }, offset: { y: { value: 6, unit: 'mm' } },
size: { width: 'fill', height: 'fill' } } }] },
{ id: 'arbol', role: 'module',
frames: [
{ name: 'raiz', style: 'nodo', width: { value: 56, unit: 'mm' }, placement: { anchor: { to: 'container', edge: 'top' } } },
{ name: 'izq', style: 'nodo', width: { value: 56, unit: 'mm' },
placement: { anchor: { to: '#raiz', edge: 'below' }, offset: { x: { value: -44, unit: 'mm' }, y: { value: 10, unit: 'mm' } } } },
{ name: 'der', style: 'nodo', width: { value: 56, unit: 'mm' },
placement: { anchor: { to: '#raiz', edge: 'below' }, offset: { x: { value: 44, unit: 'mm' }, y: { value: 10, unit: 'mm' } } } },
],
decoration: { elements: [
{ kind: 'connector', id: 'ramas', routing: 'tree', from: { to: '#raiz' }, to: [{ to: '#izq' }, { to: '#der' }] },
] } },
],- What a module has. Frames, groups (a grid that repeats included), decoration and connectors. It has no
area,header,footer,variants,spread,gutteroroverflowTemplate: each of those is reported asunknownConfigValueand ignored.extendsworks between modules (a template that extends a module is a module). - Its box. A module is as wide as its group and as tall as its frames reach; the group stacks the modules from its top,
gapbetween them. Inside a module,'container'is the module's box, for its frames ('fill'and percentages too) and for its decoration: a ground sized to{ to: 'container', edge: 'bottom' }covers the module whatever height its words give it. - Names. A module's frames, groups and elements are scoped by the module's instance name:
<name>.<frame>, with the name the Markdown gives (name="ramas") or else<template>[n], the module's count among the page's modules of that template (arbol[2].raiz). Anchors,next,continueIn: '#x'and connectors inside a module are rewritten to its own frames, so two trees on one page never join each other. A frame id readscp0:arbol[2].raiz. - When modules do not fit. A module past the group's foot is cut there and its frames climb the reflow ladder;
frameOverflowis raised once for the group. Withoverflow.continueInon the modules group ('next-page'or'template:<id>'), the first module that does not fit and every module after it go on whole to the added page, under the same names, at the top of that page's modules group. In a row or a grid of modules a row goes on whole: its modules are never split between two pages. - Side by side. A modules group with
kind: 'row'sets its modules start to end, each as wide as its template'swidth(a length,{ percent: 48 }, or'fill', an equal share of what is left) and the row as tall as its tallest module;kind: 'grid'sets them incolumnsequal columns, row after row.rowAlignplaces a module shorter than its row. Rows run from the start side of the line, so a right-to-left page sets the first module on the right. Since postext 1.50. - Groups inside the stack. A modules group with
within: '<stack>'lies inside the page's modules stack, andtemplatessays which modules it takes: each run of them in the Markdown becomes one row or grid of the stack, where its first module comes. With the groups below, twoavisoblocks followed by fourtarjetablocks make a row of two boxes over a 2 × 2 of cards, and the Markdown holds:::moduleblocks alone. - Groups inside groups. Since postext 1.51
withinmay name any modules group, to any depth. Withbandaa row insidecuerpoandcolumnaa stack insidebanda, a box followed by two cards stands beside a column of the two cards. A page frame anchored to#bandais placed after the modules. - Sharing a row. Since postext 1.51 the room a row of modules leaves goes by each module's
grow, and a row wider than its group gives width back byshrink. - Not yet. A module inside a module (
moduleNested) and templategridcells inside a module.
groups: [
{ name: 'cuerpo', modules: true, gap: { value: 8, unit: 'mm' } },
{ name: 'par', modules: true, within: 'cuerpo', kind: 'row', templates: ['aviso'], gap: { value: 6, unit: 'mm' } },
{ name: 'tarjetas', modules: true, within: 'cuerpo', kind: 'grid', columns: 2, templates: ['tarjeta'], gap: { value: 6, unit: 'mm' } },
],#When content does not fit
When a frame's content is taller than the room its group gives it, the layout tries, in order, the steps of the reflow ladder and stops at the first that makes it fit: free space up to maxHeight, the group pushing and yielding, smaller pictures, the other frames of the group down to their minimum, smaller text, continuation on another page. These frame settings decide how far each step may go:
maxHeighton a frame with a fixedheight: the frame may grow up to it before anything is scaled.minHeighton the other frames of the group: how far they give space back; a frame never goes below what its own content needs.fit.scaleImagesandfit.imageMinScale: whether the pictures of the frame and of its group may be set smaller, and down to what scale (80 % by default).fit.shrinkTextandfit.minScale: whether the frame's text may be set smaller, and down to what scale (90 % by default). The scale is the same for the font size, the leading and the spacing; the frame keeps its size.overflow.continueIn: where the content goes on when none of this is enough: another frame, or another page ('next-page','template:<id>','page:<id>'), where the text goes on at full size after the piece'soverflow.mark. A frame that can go on to another page does so before its pictures and text are set smaller, unless itsfit.preferContinueisfalse.
Scales go in steps of 2.5 % and the layout takes the largest that fits, so a text that is a line too long is set at 97.5 %, not at the minimum. A box that must keep its type size sets fit: { shrinkText: false }; a page whose pictures must keep their size sets fit: { scaleImages: false } on the frames of its group:
{ name: 'recuadro', style: 'recuadro', height: { value: 63, unit: 'mm' }, maxHeight: { value: 75, unit: 'mm' },
fit: { minScale: 0.85, imageMinScale: 0.9 } }What still does not fit is reported as frameOverflow, with the steps tried and proposals that carry their values: see The warning and its proposals.
#Inheritance and variants
A template with extends starts from the template it names (which may itself extend another) and changes only what it writes:
- A field such as
area,headeroroverflowTemplatereplaces the parent's.gridmerges key by key.spread,gutterandroleare inherited too;id,nameandextendsare the template's own. framesandgroupsmerge by name: an entry with the name of an inherited one changes the fields it writes and keeps the rest (fit,overflowandpaddingmerge key by key;placementis replaced whole);remove: truedrops it; a new name is added after the inherited ones.- Decoration elements merge by
idthe same way; an element with a new id, or none, is added. Since postext 1.42,{ id: 'head-even', remove: true }in a child template's or variant'sdecoration.elementstakes the inherited element of thatidout, asremove: truedoes for a frame; anidthe template does not inherit changes nothing. A new element with the sameidcan follow the removal in the same list.
variants.recto and variants.verso are written like a template and merge the same way, on a right or a left page. They apply after the whole extends chain, the root's variant first. A spread has both sides, so no variant applies to it. A variant element with the other side's parity is never drawn (unknownConfigValue).
pageTemplates: [
{ id: 'tema', frames: [{ name: 'texto', flow: true }, { name: 'margen', width: { value: 30, unit: 'mm' },
placement: { anchor: { to: 'container', edge: 'top-left' } } }],
variants: { recto: { frames: [{ name: 'margen', placement: { anchor: { to: 'container', edge: 'top-right' } } }] } } },
{ id: 'tema-sin-margen', extends: 'tema', frames: [{ name: 'margen', remove: true }] },
]A value equal to a default is never dropped when the Sandbox saves a template: in a template that extends another, or in a variant, it overrides the parent's value.
From code, resolvePageTemplate(config, id, { parity }) returns a template with its chain merged, the variant of the side applied, every default filled in and every reference settled as the warnings below describe; validatePageTemplates(config) returns the warnings.
#Drawn when the page says
A decoration element, and an element of the template's header or footer, may carry when or unless, each naming an attribute of the page fence. when: 'folio' draws the element only on pages whose fence sets folio; unless: 'frontmatter' leaves it off pages whose fence sets frontmatter. A fence sets an attribute when it writes it alone (::::page{template="pagina" frontmatter}) or with any value but false. One template then serves the front matter (no folio, no band) and the body pages: the Markdown says what the page is. Since postext 1.50.
decoration: { elements: [
{ kind: 'box', id: 'band', unless: 'frontmatter',
placement: { anchor: { to: 'page', edge: 'top-left' }, size: { width: 'fill', height: { value: 12, unit: 'mm' } } },
style: { backgroundColor: { hex: '#2a6f97' } } },
{ kind: 'text', id: 'folio', when: 'folio', content: '{pageNumber}',
placement: { anchor: { to: 'page', edge: 'bottom-center' }, offset: { y: { value: -8, unit: 'mm' } } } },
] }- An element anchored to an element left out, or sized to it, is left out too.
- With both keys, the element is drawn where the fence sets the
whenattribute and not theunlessone. - The document's and a section's running heads read them as well. A page that is not composed has no fence and sets nothing. Heading, part and box designs ignore them.
- A value that is not a non-empty string, or one written in a heading, part or box design, is reported as
unknownConfigValueand ignored.postext checknotes (conditionNeverMet) awhenorunlesson an attribute no page fence sets, and an{attr.x}nothing sets. - After layout,
folioMissingnames a page lacking a folio or running head that most pages of its template and side draw; one whose fence turns it off does not count. Since postext 1.53. - In the Sandbox, the element cards of running heads and decoration have Drawn when the page says and Not drawn when the page says, listing the attributes the book's fences use.
#What the layout applies
The layout applies the placement and sizes of every frame (grid, anchors, min/max, verticalAlign), its style and padding, columns, rules, layer, rotate, exclude (and its wrap), flow, takes, next, overflow.continueIn ("#frame", "next-page", "template:<id>", "page:<id>") with overflow.mark and overflow.fromMark, and its fit (the reflow ladder's text and picture scaling, see When content does not fit); a group's negotiation of space (grow, shrink, priority, pin, and the group's gap and align, see How groups share space); and the template's area, grid, decoration, header, footer, variants, spread and overflowTemplate. Since postext 1.42 it also applies the template's palette, a frame's look and an 'auto' width (as wide as the frame's longest line). A frame's writingMode and direction are applied since postext 1.39. Since postext 1.48 it applies grid groups and their repeat, modules groups and module templates, connectors and path elements in the decoration, and a frame's overlap. Read and checked, but not yet applied: the template's bodyStyle.
#Spreads
On a spread template every coordinate runs over the sheet of its two pages, with the spine in the middle: area, grid, anchors to container, page and bleed, and fill sizes all read the double width. bleed reaches the head, the foot and both outer edges, never the spine. A textbook's double-page timeline is one template:
pageTemplates: [{
id: 'linea-tiempo',
spread: true,
gutter: { value: 10, unit: 'mm' },
grid: { columns: 6, rows: 12, columnGap: { value: 12, unit: 'mm' }, rowGap: { value: 3, unit: 'mm' } },
frames: [
{ name: 'titulo', takes: 'h1', style: 'tab-titulo' },
{ name: 'texto', flow: true, width: { value: 196, unit: 'mm' },
placement: { anchor: { to: '#titulo', edge: 'below' } } },
{ name: 'recuadro', style: 'recuadro', grid: { col: 4, row: 1, cols: 3, rows: 4 }, height: 'auto' },
{ name: 'banda-1', style: 'banda', grid: { col: 1, row: 5, cols: 3 }, height: { value: 8, unit: 'mm' } },
{ name: 'banda-2', style: 'banda', crossGutter: true, width: 'fill', height: { value: 8, unit: 'mm' },
placement: { anchor: { to: '#banda-1', edge: 'right-of' }, offset: { x: { value: 2, unit: 'mm' } } } },
{ name: 'era-1', style: 'era', grid: { col: 1, row: 6, rows: 2 }, height: 'auto' },
// … era-2 to era-6, one grid column each, and the notes under the strip
{ name: 'tira', crossGutter: true, grid: { col: 1, row: 8, cols: 6, rows: 3 } },
],
}]A column gap wider than the gutter keeps the cards of a symmetric grid clear of the spine, so none of them is moved. The second band and the picture strip set crossGutter to run across it: each is read on the page that holds its centre and painted on both. Every word of the page, the era names on the tabs included, stays in the Markdown.
On a vertical (vertical-rl) book a spread is laid in the pages' flow frame, as its single composed pages are: the top of a page is the sheet's right edge and the lines run down, so the template's x runs down the sheet and its y from the sheet's right edge to its left. The sheet is the right page followed by the left one along y, the spine is a line across the template, and gutter, crossGutter and the cut between the pages read that axis; decoration is still laid over the physical sheet and cut at the spine. A horizontal timeline drawn for a horizontal book comes out turned on a vertical one: write a vertical book's template in its flow's frame. Since postext 1.38. A card that should read across the sheet takes writingMode: 'horizontal-tb': it is set horizontally and stands upright on the vertical page (since postext 1.39).
#Connectors
A connector is a line of the decoration that joins frames: the branches of a tree diagram, an org chart, the drops of a timeline, the arrows of a flow chart, a note's pointer to a place on a map. It is laid after the frames have their final boxes, so it follows a text that grows, an edition with longer words or a group that moves its frames, and it is drawn as a vector line in every output, so the template needs no picture of the lines. Connectors are elements of a page template's or a module's decoration; running heads and heading designs have no frames to join, and a connector there is reported (unknownConfigValue) and not drawn. Since postext 1.48.
decoration: {
elements: [
{ kind: 'connector', id: 'ramas', routing: 'tree', radius: { value: 2, unit: 'mm' },
width: { value: 1.25, unit: 'pt' }, from: { to: '#raiz' }, to: [{ to: '#a' }, { to: '#b' }], endCap: 'arrow' },
],
},| Property | Type | Default | Description |
|---|---|---|---|
kind, id | 'connector', string | required | The element and its id, as for the other elements of the decoration. |
from | ConnectorEnd | required | One end of the line; the parent of a tree. |
to | ConnectorEnd | ConnectorEnd[] | required | The other end, or several: one line to each, or the children of a tree. '#card[*]' stands for every card of a repeating grid the page has. |
routing | 'straight' | 'elbow' | 'tree' | 'elbow' | 'straight': one segment. 'elbow': across, along and across again between sides that face each other, an L between sides at right angles. 'tree': a trunk from from to a bar, the bar across the children's points, a drop to each child. |
trunk | number | 0.5 | Where an elbow's middle run or a tree's bar stands between the ends: 0 at from, 1 at the nearest to. A tree with trunk: 0 draws no bar: a drop from the parent's edge to each child, as the ticks of a timeline. |
radius | Dimension | 0 | Rounds the bends of an elbow or a tree. |
color | ColorValue | the main colour | A palette-linked colour follows the template's palette, the page fence's and a part's, as rules do. A colour with an alpha channel (#rrggbbaa) paints the line and its marks translucent, so a picture under it shows through (since postext 1.49). |
opacity | number | 1 | How opaque the line and its marks are, from 0 to 1, times the colour's own alpha. Kept apart from the colour, so a palette-linked colour stays linked. A cased line is two connectors: a wide pale one at opacity: 0.6 under a dashed one. Since postext 1.49. |
width, dash | Dimension, Dimension[] | 0.75pt, solid | The line's thickness, and a dash pattern (on, off, …). |
startCap, endCap | 'none' | 'dot' | 'arrow' | 'ring' | 'bar' | 'none' | A mark at from and at every to: a filled dot centred on the end, or an arrowhead whose tip is the end. 'ring': a hollow dot centred on the end, stroked in the line's width, the line stopping at its edge; 'bar': a stroke across the line at the end, in its width (both since postext 1.49). |
capSize | Dimension | 3 × width | The width of a dot or a ring, the length of an arrowhead, the length of a bar. |
over | boolean | a connector with an anchor end paints over the frames, any other under them | Paints the line after every frame of the page (true) or with the decoration, under the frames (false). Unset, a connector that has an anchor end paints over, so a pointer into a picture shows over the picture's frame; a line between frames stays under. |
pin | boolean | false | Joins the boxes the template declares, not the boxes the content gave the frames. |
parity, pages, when, unless | as other elements | 'all' | Which pages draw it. |
Each end (ConnectorEnd) names a box and a point on one of its sides:
| Field | Type | Default | Description |
|---|---|---|---|
to | '#name' | required | A frame, a group, a card of a repeating grid ('#foto[2]') or another element of the decoration. |
side | 'top' | 'bottom' | 'left' | 'right' | 'start' | 'end' | the side facing the other end | The side the line leaves or meets the box by. start and end follow the page's line direction. Unset, the side that faces the other box across the wider gap between them; a tree's children face the parent. |
at | 'start' | 'center' | 'end' | number | 'center' | The point along that side, or a fraction of it from its start (0 to 1). A horizontal side starts where the page's lines start, a vertical one at its top. |
gap | Dimension | 0 | Room between the box's edge (or the anchor point) and the end of the line. |
anchor | string | none | An anchor of the picture the frame holds: the end is that point of the picture, through its crop, safe area and scale, as a label's is, instead of a point of the frame's side. at is not read; side says which way the line arrives (by default, from the other end). |
Ends that are not there. An end on a frame the page does not show (collapsed, optional and empty, a card past the page's items, a picture point that its frame cuts off) is left out: a tree keeps its other children, and the page's reflow log says so (connectorDropped). With no from or no to left, nothing is drawn.
Paint. Connectors are painted as vector paths: on the canvas, in the PDF, in the HTML viewer and the fixed-layout EPUB, and as a layout artifact in a tagged PDF; the reflowable EPUB leaves them out with the rest of the decoration. A connector with an anchor end is painted over every frame of the page, so a line that points into a picture shows over the picture's frame without a layer on it; the other connectors stay with the decoration, under the frames. over: true raises a line between frames, over: false keeps a pointer under them. On a spread a connector between frames of the two pages crosses the spine and is cut there like the rest of the decoration; on a right-to-left page start and end follow the mirrored flow.
frames: [
{ name: 'mapa', width: { value: 118, unit: 'mm' } },
{ name: 'nota', style: 'nota', width: { value: 44, unit: 'mm' } },
],
decoration: { elements: [
{ kind: 'connector', id: 'a-lago', from: { to: '#nota', side: 'end' },
to: { to: '#mapa', anchor: 'lago', gap: { value: 1.2, unit: 'mm' } }, endCap: 'dot' },
] },Checks. An end whose to names nothing is frameAnchorUnknown (at …/from/to or …/to/<k>/to) and is left out; [*] is valid only in to and on a repeated frame. An anchor that no picture of the frame has is labelAnchorUnknown, with the connector's id. A word outside the choices of routing, startCap, endCap or side, and an at outside 0 to 1, are unknownConfigValue. An opacity that is not a number from 0 to 1 is unknownConfigValue as well (a number out of range is held to it).
#Frame looks
A grid of photo cards whose pills differ only in colour, or a page of boxes in a dozen tints, keeps one callout style and one template: the colours go in frameLooks, a list of named looks, and the Markdown names one on each piece that wears it. Since postext 1.50.
frameLooks: [
{ id: 'rojo', name: 'Red pill', background: { hex: '#e63946', model: 'hex' }, body: { color: { hex: '#ffffff', model: 'hex' } } },
{ id: 'verde', background: { hex: '#6a994e', model: 'hex' } },
{ id: 'marino', border: { color: { hex: '#264653', model: 'hex' } } },
]| Field | Meaning |
|---|---|
id | Required. The word a piece writes in look="…". When two looks share an id, the first one is used. |
name | Shown in the Sandbox only. |
The fields of a frame's look | background, border.color, stripe.color, icon.color, marker.color, marker.rule.color, titleStyle.color, body.color, body.boldColor, body.italicColor, body.letterSpacing, label.color, label.background, label.rule.color, named and nested as in the frame's look (see Frames). A background also turns the style's fill on; a tab colour only applies to a style that has a tab. |
- Where it applies. A
:::frame{slot="…" look="<id>"}piece wears the look. On a grid, the item's main piece and a member's nested:::frameeach name their own (see Composed pages › Frame looks). - Order. The look is laid over the frame's callout style and over the template frame's own
look, key by key: a look that sets only the fill keeps the template's text colour. It applies to that piece only. The frames its text goes on in (a chain, a page added by continuation) wear it too. - Palettes. A colour linked to a palette entry follows the palette as every colour of the configuration does, so a part palette or a page's
paletterecolours it. - Checks. An entry with no
idis ignored (unknownConfigValue), and a key a look does not have is anunknownConfigKeyat any depth, with the nearest name. A piece that names an id no entry has keeps its frame's colours and raiseslookUnknown.
In the Sandbox the looks are edited under Design › Boxes › Frame looks, which also counts the pieces that name each one, and the editor's Frame look button writes look="…" on the piece the caret is in.
#Label styles
The labelStyles property names the looks of the labels set on a picture: the seas and towns of a map, the parts of a diagram. A label stands at an anchor of the picture (a point stored with the resource, as comic speakers are) and takes the style the anchor or the label names. In the Sandbox they are edited under Design › Figures & tables › Label styles (since postext 1.42). Renaming a style there rewrites the anchors and the ::label lines that name it (since postext 1.43).
labelStyles: [
{ id: 'mar', fontStyle: 'italic', textTransform: 'uppercase', letterSpacing: 0.12,
color: { hex: '#2b6ca3', model: 'hex' } },
{ id: 'ciudad', fontWeight: 600, halo: { color: { hex: '#ffffff', model: 'hex' }, width: { value: 0.6, unit: 'pt' } } },
]| Property | Type | Default | Description |
|---|---|---|---|
id | string | required | The name anchors and labels use. |
name | string | the id | The name shown in the Sandbox. |
paragraphStyle | string | none | A paragraph style whose type the label borrows; the fields below override it. |
fontFamily, fontSize, fontWeight | string, Dimension, number | the body text's | The type of the label. |
fontStyle | 'normal' | 'italic' | 'normal' | Upright or italic. |
color | ColorValue | the body text's | The colour of the letters. |
textTransform | 'none' | 'uppercase' | 'none' | Capitals, as maps set seas and countries. |
letterSpacing | number | 0 | Extra space between letters, in ems. |
halo | { color, width } | none | An outline behind the letters, so they read over a busy picture. |
background, padding | ColorValue, Dimension | none | A plate behind the label, and the room around its text. |
minScale | number | 0.85 | How small a label may be set when it does not fit its width. |
writingMode | 'horizontal-tb' | 'vertical-rl' | 'horizontal-tb' | Vertical writing for the labels of this style: characters upright in cells one under another, columns from right to left, as a Chinese or Japanese map is lettered. An anchor's own writingMode wins. |
overlap | 'check' | 'allow' | 'check' | 'allow' leaves the labels of this style out of the labelOverlap check, for a map whose names touch in the source. An anchor's own overlap wins. Since postext 1.42. |
align | 'start' | 'center' | 'end' | as the anchor places the box | How the lines of a label of several lines line up inside its box, start and end in the label's direction. Unset, they follow the anchor's align (centred by default); in a legend, start. Since postext 1.48. |
border, radius | { color, width }, Dimension | none | A line round the label's plate (its box grown by padding), with or without a background, and the plate's rounded corners: the framed key of a map. Since postext 1.48. |
kind | 'legend' | none | A map's key: each line of the label is a row, and the symbol (:icon) that opens a row hangs in a column as wide as the widest of them, so the words of every row start on one edge. A row without a symbol is left as it is. Not in vertical labels. Since postext 1.48. |
leader | { color?, opacity?, width?, dash?, startCap?, endCap?, capSize?, routing? } | none | The look of the leaders of the labels set in this style: the line from a label's box to its anchor's point. Colour by default the label's, width 0.75pt, endCap: 'dot' at the point, no startCap, capSize three times the width, routing 'straight' (or 'elbow': out of the box square, then one turn onto the point). A label set away from its point (labelAt) in a style with a leader gets one. Since postext 1.48. startCap and endCap take the connector's marks, 'ring' and 'bar' included, and opacity (0 to 1) or a colour with an alpha channel makes the line translucent (since postext 1.49). |
A label in no style, or in a style that names no type, takes the body text's family, size, weight and colour. The lines of a label of several lines stand 1.15 times its size apart, or at the borrowed paragraph style's leading. Through paragraphStyle a label also takes that style's italics and capitals; fontStyle: 'italic' and textTransform: 'uppercase' add them to a style that borrows none. A label style that writes fontStyle: 'normal' or textTransform: 'none' turns off the italics or the capitals of the paragraph style it borrows from (since postext 1.40); when they are left out, the paragraph style's italics and capitals hold. A label set smaller to fit keeps its halo in proportion.
#Label fields of an anchor
A picture's anchors (Resource.anchors, the points comics use for speakers) take a few optional fields for labels. They are fractions of the picture, so they hold in every language and through any crop of the picture. Comics ignore them.
| Field | Type | Default | Description |
|---|---|---|---|
width | number | the label's own | The measure of the label, as a fraction of the picture's width: a long name breaks onto two lines inside it. |
align | 'start' | 'center' | 'end' | 'center' | Which side of the label stands at the anchor point. |
verticalAlign | 'top' | 'middle' | 'bottom' | 'middle' | Which edge of the label stands at the anchor's height. |
rotate | number | 0 | Degrees, clockwise, around the anchor point: a river's name along its course. |
style | string | none | A labelStyles id. A label that names its own style overrides it. |
writingMode | 'horizontal-tb' | 'vertical-rl' | 'horizontal-tb' | 'vertical-rl' sets the label vertically, as a Chinese or Japanese map or a spine is lettered. Its width is then a fraction of the picture's height, align runs along the column (start is the top) and verticalAlign across the columns (top is the first, right-hand one). |
overlap | 'check' | 'allow' | 'check' | 'allow' says the label set at this anchor may touch its neighbours, as the source prints it: labelOverlap is not raised for a pair it belongs to. It takes precedence over the style's overlap. Since postext 1.42. |
gutter | 'keep' | 'cross' | 'keep' | On a figure across the spine of a spread, 'keep' slides the label off the gutter band, to the side its point lies on; 'cross' leaves it where the point puts it, as a title across both pages needs. Since postext 1.43. |
labelAt | { x: number; y: number } | at the point | Where the label set at this anchor stands, away from its point, in fractions of the whole picture: a name in the sea with a line to the island it names. align, verticalAlign and rotate place the label about this point; the anchor's own point stays where leaders and connectors end. Since postext 1.48. |
leader | boolean | LeaderStyle | see below | A line from the label's box to the anchor's point. true draws it in the label style's leader look, an object changes that look field by field, false draws none. Unset, a label set away from its point gets one when its style has a leader. The leader attribute of a ::label wins. Since postext 1.48. |
start and end follow the label's direction: in an Arabic label, start is its right edge. An anchor shared by left-to-right and right-to-left editions of one map reads best with the label centred above or below its point. A label with a width breaks between words; a word wider than the measure sets the whole label smaller, down to its style's minScale. How labels are drawn is described in Composed pages.
A leader leaves the label by the side of its box (its plate, else its lines) that faces the point across the wider gap, from the middle of that side, so the line never runs through the label's words, a turned label included. A point under the label's box, or a leader shorter than its end mark, draws nothing. Leaders are painted under the labels, with the picture, in every output that draws labels, and they follow the picture when it is cropped, scaled, mirrored or set across a spread.
anchors: [
{ id: 'peaks', x: 0.42, y: 0.8, labelAt: { x: 0.62, y: 0.6 }, style: 'name', leader: true },
{ id: 'lake', x: 0.531, y: 0.865, labelAt: { x: 0.76, y: 0.93 }, style: 'name', leader: { routing: 'elbow' } },
],#Page template warnings
Elsewhere the engine ignores a key it does not know. Page templates and label styles are checked instead, and every problem is a configuration warning in postext check and in the Sandbox's Checks panel. The path of these warnings is a JSON pointer to the field at fault: /pageTemplates/3/frames/2/style, /pageTemplates/0/variants/recto/frames/1/next, /resources/4/anchors/0/style. When the field was inherited, the pointer names the template that wrote it. A warning that names an id or a name that does not exist also suggests the closest one that does.
A misspelt key of a template, frame, group, grid, fit, overflow, variant or label style is an unknownConfigKey; a word outside a setting's choices (area, verticalAlign, exclude, wrap, takes, kind, align, writingMode, direction, fontStyle, textTransform, overlap, rowAlign, a connector's routing, caps and side, a leader's caps and routing) is an unknownConfigValue, and the setting keeps its default. A template with no id, or a frame or group with no name, is ignored with an unknownConfigValue at that field. Frame looks (frameLooks) are checked the same way: a look with no id is ignored, and a key a frame's look does not have is an unknownConfigKey.
| Warning | Cause | Fix |
|---|---|---|
templateDuplicate | Two templates have the same id. The first one is used and the later one is ignored. | Rename one of them, or delete the copy. |
templateExtendsCycle | Following extends comes back to the same template (a → b → a). Every template of the loop, and every template that extends one of them, is dropped: no page can use it. | Remove the extends of one template of the loop. |
templateExtendsUnknown | extends names an id that no template has. The template is used on its own, with nothing inherited. | Correct the id (the warning suggests the closest one), or add the parent template. |
frameDuplicate | Two frames, or two groups, of one list have the same name, or a group has the name of a frame. The later entry is ignored; an anchor to that name reads the frame. | Give each frame and group a name of its own. To change an inherited frame, write one entry with its name. |
frameStyleUnknown | A frame's style names no callout style. The frame is drawn without a box. | Correct the id, or add the style to calloutStyles. |
frameAnchorUnknown | A frame, a group or a decoration element is anchored to '#name' and the template has no frame, group or element of that name; or frames and groups are anchored to each other in a loop (also through a group anchored to nothing of its own, whose box is that of its frames). The anchor reads as 'container', the area. An end of a connector that names nothing is reported the same way, and that end is left out. | Anchor to a frame or group that exists, or break the loop by anchoring one of them to the area. |
frameMinMax | A minimum is larger than its maximum (minHeight 40mm > maxHeight 30mm), or a fixed width or height lies outside them. The minimum wins, a fixed size is brought between the limits, and used says what the frame takes. Lengths in different units are compared at the page's resolution, ems at the body text size. | Make the minimum no larger than the maximum, or drop the limit the fixed size contradicts. |
groupFrameUnknown | A group's frames lists a name that is not a frame of the template (perhaps removed by a child template or a variant). The group skips it. | Correct the name, or remove it from the list. |
groupFrameTwice | A frame is listed in two groups, or twice in one. A frame belongs to one group only: the later listing is skipped. | Keep the frame in the one group it moves with. |
frameChainLoop | Frames continue into each other in a loop through next or overflow. (a → b → a). The link that closes the loop is dropped, so the chain ends at the frame before it. | End the chain at its last frame: remove its next, or make it continue on the next page. |
overflowTargetUnknown | A next names no frame of the template; an overflow.continueIn names no frame ('#x') or no template ('template:x'), or is in none of the forms '#frame', 'next-page', 'template:<id>' and 'page:<id>'; or overflowTemplate names no template. Content that does not fit does not continue there. | Correct the name or the id, or write one of the four forms. |
labelStyleUnknown | An anchor of a picture names a style that labelStyles does not have. The warning names the resource. The labels at that anchor take the default look. | Correct the style id on the anchor, or add the style to labelStyles. |
Since connectors (postext 1.48) the configuration version is 16; page templates had brought it to 15. Bundles written earlier still load unchanged: nothing an older configuration says changes meaning, and a reader older than connectors leaves out the decoration elements it does not know, with an unknownConfigValue.
#Overlap, repeat and module warnings
These warnings come from the layout or from the page's Markdown, not from the template alone, so they name a page. They are listed by postext check (--json carries their fields as data), in the Sandbox's Checks panel and in the document's contentWarnings. Since postext 1.48, lookUnknown since postext 1.50.
| Warning | Cause | Fix |
|---|---|---|
frameCovered | Ink of a frame (its lines, its tab or title, its pictures) lies under another frame painted over it: a higher layer, or the same layer later in template order. A frame covers where it is opaque: its fill, its tab, its pictures, its lines; an outline alone covers nothing, and words over a picture are not reported. One warning per pair, with the covering frame (coveredBy), the area hidden (overlapMm2) and the first words or the picture covered. See Composed pages › frameCovered. | Apply a proposal: the covering frame's layer under the covered one, exclude: 'push' on it so the text runs round it, or a move worked out on the page. When the overlap is meant (art over text), set overlap: 'allow' on either frame. |
frameOutsideArea | A frame runs past what holds it: its text past the trim, its fill or pictures past the bleed, or any of it past the frame or group it is anchored inside (a nine-point anchor on '#name' whose point lies within that box). past says which, excessMm by how much. See Composed pages › frameOutsideArea. | Apply a proposal: a maxHeight for the frame, a minHeight for the frame it is anchored inside, overflow. with a smaller height, or a move. A badge hung off its card on purpose takes overlap: 'allow'. |
repeatOverflow | A grid that repeats a frame set holds repeat.max items and the page gives it more. One per item over, at its slot="…": the item goes to the flow frame (flowFrame), or after the page. | Raise max, remove it, or move the extra items to another page. |
lookUnknown | A :::frame piece writes look="…" with an id that no frameLooks entry has (see Frame looks). The frame keeps its style and its template colours. Points at the attribute's value, and names the nearest id (suggestion). | Correct the id on the piece, or add a look with that id to frameLooks. |
moduleUnknown | A :::module{template="…"} the page does not lay: the id names no template (reason: 'unknown'), a template that is no module ('notModule'), or the page's template has no modules group ('noGroup'). Its content goes to the flow frame. | Correct the id, give the template role: 'module', or add a group with modules: true to the page's template. |
moduleAsPage | A page fence names a module template. A module is laid in a page's modules group, never as a page: the fence's content is set in the flow, as for an unknown template. | Name a page template on the fence, and put the module inside it as a :::module. |
moduleNested | A :::module inside another module. Not supported: its blocks are the outer module's. | Close the outer module first, or draw the inner block as frames of the outer module. |
moduleNameRejected | A module's name="…" is taken by another module of the page (reason: 'taken') or holds a space, ., #, [ or ] ('invalid'). The module is named used (<template>[n]) instead, and its frames are addressed under that name. | Give each module of the page a name of its own, made of letters, digits and dashes. |
connectorDropped (reflow log). A connector whose end is on a frame the page does not show (collapsed, optional and empty, a card past the page's items, a picture point its frame cuts off) leaves that end out. It is not a warning: the page's reflow log records it, «connector ramas left out izq (not on the page)», so a page where a branch went missing can be told from one drawn as planned. To keep the end, give that frame content, or let the connector go to the frames the page has.