Page Layout Model
PDF Page Layout Model
The PDF layout model has two related browser paths: an interactive PDF preview inside the editor and a book exporter for full-site output. Both consume Hugo-rendered DOM and print metadata.
Shared Page Primitives
cdn/custom/nowtypePdfCore.js centralizes small editor-side page primitives:
- paper specs such as A4 and A3;
- page roles such as title, ToC, and content pages;
- spread normalization and first-page side;
- route/scope inference for chapter, part, and book modes;
- sizing helpers used by the editor PDF surface.
The CLI book exporter has its own paper, page metrics, and frontmatter page
roles under scripts/book-pdf/. Do not assume nowtypePdfCore.js is the
single metric or role authority for every export path.
Logical document font size is separate from viewport scale. Resizing the browser should change display scale, not the authored page’s print typography.
Current Composition Model
The older browser compositor paginates one rendered DOM tree and presents page-sized windows. That path is useful but limited: it can struggle with floats, footnotes, line breaks, and true TeX-like page building.
The editor page-builder path currently records diagnostics: flow-like items, interpreted page slices from existing breaks, and warning data. It is not yet the rendering authority for explicit page trees.
The CLI book export path is separate. It prepares and mutates a Chromium DOM for book output: long-table splitting, footnote decks, float handling, hyphenation/typography hints, math scaling, figure legibility promotion, cross-reference normalization, accessibility probes, running-head probes, and layout diagnostics before Chromium writes the PDF.
What Hugo Owns
Hugo owns:
- equations, figure/table labels, and local reference identity;
- rendered captions and object metadata;
- print/export attributes on figures, tables, equations, citations, and refs;
- Markdown and front matter as the authoring source of truth.
Browser layout code owns measurement, page-break selection, preview state, and export orchestration.
Files To Read
cdn/custom/nowtypePdfCore.jscdn/custom/toggleMarkdown.jsscripts/book-pdf/browser-page-builder.jsdocs/nowtype-browser-page-builder-plan.mddocs/pdf-generator-gap-analysis.md