Browser PDF Mode
Browser PDF Mode
Browser PDF mode is an editor/preview surface over Hugo-rendered content. It is not a second Markdown renderer. The mode lives in the shared edit surface and uses Nowtype plus generator-specific PDF helpers to present content as pages.
Enablement
Sites can expose PDF behavior through params.qlMarkdownEditor.* values and
the normal edit-mode provider path. Important flags include:
pdfVisitorMode: open a read-only PDF/book view for visitors.pdfVisitorSpread: default visitor view to two-page spreads.pdfVisitorFirstPageRight: start page 1 on the right in spread mode.pdfPageBuilder: enable the newer page-plan diagnostics/path where supported.
The runtime also persists local PDF preferences such as paper size, spread mode, book margins, first-page-right, margin notes, paper size, font point size, ToC page toggle, profiling, and page-builder diagnostics.
Toolbar Surface
The PDF toolbar covers:
- print scope: chapter, part, or book depending on route;
- paper size and logical font size;
- single page versus spread preview;
- first-page side and recto/verso behavior;
- page navigation;
- title/book behavior and a generated ToC page toggle where supported;
- margin/note display controls;
- print popup entry points.
The print action should use the editor’s composed PDF page shell rather than the browser’s default flowing print layout. File-producing full-book export is the Node/Playwright CLI path, not the in-browser editor toolbar.
Visitor/book view also has source-backed behavior for draft/teaching contexts,
including TutorLumin book.yaml discovery paths. Treat those as viewer/provider
integration details over the same Hugo-rendered source contract.
Boundary
Hugo emits the semantic HTML and data-ql-print-* metadata. PDF mode measures,
composes, previews, and exports that rendered content; it should not reimplement
shortcodes, render hooks, or bibliography logic in JavaScript.
Files To Read
cdn/custom/toggleMarkdown.jscdn/custom/nowtypePdfCore.jscdn/editor/src/*docs/pdf-page-layout.md