Book Authoring Contract

PDF Book Authoring Contract

Book export treats a Hugo site as the source of truth. Authors structure content with Hugo sections, page front matter, Markdown, figures, tables, equations, citations, and optional definitions data.

Book Structure

The root content page provides book-level metadata and options. Top-level sections can become parts, child pages become chapters, and special sections such as bibliography, references, appendices, acknowledgements, glossary, and backmatter are classified by manifest construction.

Current exporter ordering uses front matter weight first, then URL/path. Do not depend on numeric directory prefixes.

Authoring Hints

Figures and tables can express print intent through classes or attributes:

  • float placement: here, top, bottom, page;
  • side figures: left or right;
  • tables: long, keep, landscape, numeric alignment;
  • generated glossary/index behavior through root options and definitions data.

Definitions can live in small data files such as thesis or print definitions JSON/YAML/YML. Undefined terms, acronyms, or symbols should become diagnostics rather than silent output drift.

Render Metadata

Hugo render hooks emit data-ql-print-* metadata for objects before browser export code measures the DOM. The exporter should consume those attributes first and use DOM inference only as a compatibility fallback.

Files To Read

  • docs/pdf-generator-gap-analysis.md
  • scripts/export-site-book-pdf.js
  • layouts/partials/print/object-attrs.html
  • layouts/_default/_markup/render-image.html
  • layouts/_default/_markup/render-table.html
  • layouts/_default/_markup/render-passthrough.html