Validation & Best Practices
Gutterpress's validation system checks your project for print compliance at two points in the pipeline --- before the PDF build and after. This chapter covers the 35 built-in checks, CLI usage, and production workflow recommendations.
Validation Overview
The validation system runs checks at two phases:
- Pre-build --- Source, asset, and some heuristic checks run before PDF generation
- Post-build --- PDF structural, print compliance, and quality checks run after PDF generation
When using gutterpress build, validation is automatically integrated into the
pipeline:
validate:pre-build -> convert -> assets -> build -> validate:post-build
The CSS print-safety check (remote URLs, rasterizing effects, and
page-containment risks) runs once, inside validate:pre-build, as the
source.stylelint check --- standalone, gutterpress validate my-book --only source.stylelint runs just that check.
There is no separate lint phase; --skip-lint disables that one check
without skipping the rest of pre-build validation.
The final validate:post-build phase runs for --format pdfx only --- a plain
--format pdf build stops after the build step. Everything before it runs for
both formats.
Publish Targets
Where you publish is a separate decision from how your book is designed
(the preset: --- see Chapter 1). A target is a place the book goes, and
it says which file it gets and what its platform demands of that file. A
target never changes how the book is laid out --- only which file is made
from the layout and what that file is checked against.
drivethrurpg-print(ordtrpg) --- DriveThruRPG print-on-demand, which gets the PDF/X: PDF/X markers and metadata, CMYK/Grayscale art, the 240% ink limit at each page's heaviest spot, the bleed on the top, bottom and outside edges, embedded fonts, a page count that fits the signature, text kept at least 0.5in inside the trim and pictures 0.25in, or run to the page's edge (the safe-margins check, frompage.safeandpage.artSafe; it reads text and images, so check backgrounds and borders with the preview's print overlays, Chapter 1). It also warns when text at 24pt and under is printed in a dark four-colour mix, black or a dark colour, since small four-colour text can look fuzzy.itchanddrivethrurpg-digital--- digital releases, which get the PDF: a well-formed PDF with embedded fonts; print-only rules (PDF/X, ink limits, CMYK-only art) don't apply.- The other targets (a folder, Google Drive, KDP, Shopify, a website) add no rules of their own: their file is checked against your book's own settings.
Your book's targets are the entries under publish: in its manifest
(Chapter 8), and publishing checks each file against each target it goes to:
publish:
drivethrurpg-print:
itch:
The report labels each target's findings ([drivethrurpg-print], [itch]),
so one source can be checked for print and digital at the same time. A new
book starts with its template's targets, or its preset's (the dtrpg preset
starts with DriveThruRPG print; book and custom with none), written under
publish:. In the desktop app you change them in Publish → Targets.
In a hand-written manifest with no publish: key, the preset's default
applies; publish: {} means none. An older book's targets: list still
works.
Your own manifest settings always win over a target's policy --- a target
only fills in what you haven't set.
The DriveThruRPG print target's checks need qpdf and Ghostscript installed (Chapter
7). With the target selected but the tools missing, validation reports the
required checks as errors rather than silently skipping them --- that's
deliberate: "validated for DriveThruRPG" must mean the checks actually ran.
If you're not ready to install them, remove the target until you are. The
itch target needs no external tools.
CLI Usage
Validate a PDF
# Validate an existing PDF for print compliance
gutterpress validate --pdf dist/my-book/my-book-pdf.pdf
# With a manifest for project-specific settings
gutterpress validate --pdf dist/my-book/my-book-pdf.pdf --manifest ./manifest.yaml
# Validate against a specific publish target's requirements
gutterpress validate --pdf dist/my-book/my-book-pdf.pdf --target dtrpg
# One source, two destinations: check DriveThruRPG print AND itch.io digital
gutterpress validate --pdf dist/my-book/my-book-pdf.pdf --target dtrpg,itch
Preflight report
# Run post-build checks and write JSON + markdown reports
gutterpress preflight --pdf dist/my-book/my-book-pdf.pdf --target dtrpg
# Custom report location
gutterpress preflight --pdf dist/my-book/my-book-pdf.pdf --report-dir .reviews --name release-preflight
Validate source files
# Run source and asset checks on your project
gutterpress validate --input ./my-book
# Both pre-build and post-build checks together
gutterpress validate --input ./my-book --pdf dist/my-book/my-book-pdf.pdf
Filtering checks
# Only PDF checks
gutterpress validate --pdf dist/my-book/my-book-pdf.pdf --category pdf
# Only source and asset checks
gutterpress validate --input ./my-book --category source,asset
# Run a single specific check
gutterpress validate --pdf dist/my-book/my-book-pdf.pdf --only pdf.print.page-size
# Run a group with wildcard selectors
gutterpress validate --input ./my-book --only source.links.*
# Skip specific checks
gutterpress validate --pdf dist/my-book/my-book-pdf.pdf --skip pdf.nav.cross-refs
# JSON output for CI
gutterpress validate --pdf dist/my-book/my-book-pdf.pdf --format json
CLI Arguments
| Argument | Description |
|---|---|
--pdf |
Path to PDF file (enables post-build checks) |
--input |
Source directory (enables pre-build checks) |
--manifest |
Path to manifest.yaml |
--category |
Comma-separated: source, pdf, asset, heuristic |
--only |
Run only these check IDs (comma-separated, supports *) |
--skip |
Skip these check IDs |
--format |
Output format: text (default) or json |
--phase |
Override phase: pre | post | all | pre-build | post-build (default: all) |
--target |
Targets to validate against (comma-separated: drivethrurpg-print or dtrpg, itch, …), overriding the book's publish: list |
--fix |
Rewrite the source markdown in place with markdownlint's auto-fixes (source.markdownlint only) |
Fixing markdown automatically
Validation is read-only unless you pass --fix, which rewrites the markdown
in place using markdownlint's own auto-fixes --- trailing spaces, multiple blank
lines, blank-line placement, list markers and indentation, hard tabs, emphasis
style, and so on:
gutterpress validate --input . --fix
Every rewritten file is printed. Anything markdownlint cannot fix
mechanically is still reported, and the other source checks (broken links, alt
text, layout markers, CSS print-safety) are never touched. The rules come from
the same .markdownlint.* config the check uses; with no config file, --fix
says so and changes nothing. A file with uncommitted changes is rewritten too
--- you get a notice, not a refusal.
Check Categories
Source checks (pre-build)
Run on markdown source files and assets before the PDF is generated. Catch authoring errors early.
Examples: broken internal links, missing alt text, oversized source images, markdown lint errors, a mistyped marker or a variant word a plugin component does not declare (@card featuerd), a class in your markdown that no stylesheet mentions ({.hilite} or @section .pannel, with a "did you mean" when one is near; always a warning, one per class per file), and the structure checks a plugin component opts into with validate (Chapter 5).
The CSS check also tells you when the live preview cannot follow a break in your stylesheet. The preview reads your forced breaks (break-before/break-after: page, left, right) and page: assignments from the CSS text, so one written with var(), inside a nested rule, right after a nested rule, or with the old page-break-before: always spelling is honoured by the PDF but missing from the preview, and the two page counts drift apart. Rule id printsafe/preview-cannot-follow; write the keyword in a flat rule, or silence it like any other rule below.
The character check finds characters that usually arrive by pasting from a chat model, a word processor or a web page: em and en dashes, curly and look-alike quote marks, the ellipsis character, bullets, arrows, emoji, and invisible ones such as zero-width spaces, non-breaking spaces and control characters. Each finding has its line and column and says what to type instead. Dashes, curly quotes and the ellipsis character are info, since they print correctly; the rest are warnings, since they can change what prints. Plain typing already prints proper typography, so the fix does not change the page: --- prints an em dash, -- an en dash, ... an ellipsis, and straight quotes print curly. So do the other shortcuts every Gutterpress book has had: (c), (r), (tm) and +- print ©, ®, ™ and ±, a run of dots prints one ellipsis, and runs of ,,, ???? and !!!! print one comma, ??? and !!!. A (c) after a (b) in the same file is the next label of a lettered list and prints as typed; a backslash (\(c)) keeps any of them as typed. The one curly character the check lets through is an apostrophe that starts a word (’90s), which a typed ' cannot make. A character you do want can be written as an HTML entity ( , →), which the check leaves alone. In the desktop editor each one is outlined where it sits, and the invisible ones show as a placeholder symbol. The editor also marks every line the Problems list reports; the Highlight problems in the editor setting (Settings, Editor tab) turns those marks and the outlines off. Rule id source.characters; silence it like any other rule below.
The markdown check also reports each HTML tag written into the markdown (<span>, <br>, <div>), one finding per tag on its line: Gutterpress cannot check HTML, and a tag left open styles everything after it. Write markdown or a marker instead. HTML comments, code and entities ( ) are not reported, nor is HTML a plugin adds. The finding's code is raw_html: a book that means its HTML sets raw_html: off in checks, and a reviewed line or table is skipped as below.
PDF checks (post-build)
Run on the generated PDF. Verify structural correctness and print compliance.
Examples: page size matches manifest, fonts are embedded, metadata is present, PDF/X compliance, text kept clear of the trim.
Safe margins
pdf.print.safe-margins reads where each line of text and each picture sits on the finished pages and reports any that is closer to the trim than its rule. For the dtrpg preset that is text 0.5in on every edge (page.safe) and art 0.25in on the top, bottom and outside edges, 0.5in at the binding (page.artSafe), which are DriveThruRPG's rules. Each finding names the page, the first words of the line or the size of the picture, the edge and how far to move it in:
Page 14: "Chapter Three" is 0.12in too close to the outside edge.
Page 27: a 2.0 x 3.0in image is 0.2in too close to the binding edge.
It measures each page against that page's own trim: the page less the bleed on the top, bottom and outside edges only. Page 1 is a right-hand page, so the outside edge is the right on odd pages and the left on even ones. A book that sets page.gutter is held to that distance at the binding edge instead, and the finding says so.
A picture that runs out to the page's edge is a bleed, as it should be, and passes on that edge. One that crosses the trim but stops short of the page's edge is reported too: it ends in the bleed band, where the cut can leave a white sliver, so it should either bleed all the way or stay inside the art line.
It checks text and images. Backgrounds, borders and rules are judged in the preview, by the Safe area: art layer of the print overlays (Chapter 1), which applies the same rule for art. The Safe area: text and Safe area: art layers draw the lines this check reads.
| Where | Safe margins is |
|---|---|
The dtrpg preset or target |
An error |
The book preset |
A warning |
The itch target |
Off: a digital release has no trim |
No page.safe (the custom preset sets none) |
Nothing to measure, so it passes |
Run it like any other PDF check:
gutterpress validate --pdf dist/my-book/my-book-pdfx.pdf --target dtrpg
gutterpress preflight runs it too, and so does the last step of a --format pdfx build. It reads the PDF itself and needs no extra tool, but the PDF/X lines in the same run need qpdf and Ghostscript installed (Chapter 7). To turn it off or change its severity, use checks like any other check (see Manifest Configuration below). The desktop app runs it when you tick Check my book before saving in Publish and lists what it finds in the Problems list; the Safe area layers draw the same lines while you write.
Asset checks (pre-build)
Run on image and font files anywhere in your project folder --- there's no assets convention to follow (see Chapter 3) --- plus the directories any shared stylesheets pull assets from.
Examples: image resolution below 300 DPI, images with an alpha channel, missing font files.
Heuristic checks (post-build)
Quality proxies that catch common issues not detectable from structure alone.
Examples: the characters a page carries, decorative layers on one page, paragraphs in one section.
Manifest Configuration
Add a checks map to turn a check off or change how loudly it reports. Each
key is a check id (shown with every finding) or a CSS print-safety rule id
(printsafe/...); each value is off, on, info, warn or error. on
keeps the check's own severity.
checks:
pdf.structure.qpdf: off
source.accessibility.alt-text: off
# A PDF cannot open a relative link such as [spec](docs/spec.md) -- the
# build drops its href before print and `source.links.dangling` warns
# about each one. Switch it off for a book published only as HTML.
source.links.dangling: off
source.markdownlint: off
printsafe/page-containment: warn
The limits a check measures against --- the ink-coverage limit, the minimum
image resolution, the largest image file --- come from the preset and the
publish target. A book that needs another one sets it as an option of that
check: write the check's entry as a map, with level beside the option when
you change that too.
checks:
pdf.print.ink-coverage:
maxTac: 300
pdf.print.image-resolution:
level: error
minImageResolution: 200
| Check | Option | What it sets | Default |
|---|---|---|---|
pdf.print.ink-coverage |
maxTac |
The total ink limit in percent, measured at each page's heaviest spot. The PDF/X conversion does not apply it: the ICC profile sets the ink (CGATS21_CRPC1 keeps it to about 240%) | 240 for dtrpg, 400 for book |
pdf.print.ink-coverage |
tacTolerance |
How far over maxTac a page may measure |
0.5 |
pdf.print.page-size |
tolerance |
How far, in points, the PDF's page may differ from page.width and page.height |
0.5 |
pdf.print.image-resolution |
minImageResolution |
The lowest DPI an image may print at; 0 for no floor | 300 (itch.io: 0) |
pdf.print.bleed |
bleedSize |
The bleed, in points, the top, bottom and outside edge of each page must have | 9 |
asset.image.file-size |
maxImageSize |
The largest image file, in bytes; 0 for no limit | 10000000 (itch.io: 0) |
asset.font.approved-files |
approvedFontFiles |
The font files the book may ship, as patterns such as fonts/*.woff2; a font no pattern matches is reported |
none: every font |
heuristic.decoration.layer-count |
maxDecorativeLayers |
The most decorative layers on one page | 5 |
heuristic.whitespace.text-density |
textDensityRange |
{ min, max }: the characters a page should carry |
200 to 5000 |
heuristic.chunking.section-density |
maxParagraphsPerSection |
The most paragraphs in one section | 10 |
A manifest written for 0.11.22 spelled these ink.maxTac, ink.tacTolerance,
page.tolerance, validate.assets.maxImageSize,
validate.assets.approvedFontFiles, validate.pdf.minImageResolution,
validate.pdf.bleedSize and validate.heuristics.*. They still work in
0.11.23: each is read as the option above, and one notice names its new
spelling. Book setup writes them the new way the next time it saves the book.
A value the option cannot take, such as a word where a number goes, is named
in the notice and ignored, as it was in 0.11.22; written as an option of the
check, the same value stops the build with an error naming it.
The Markdown and HTML linters are opt-in: source.markdownlint reads a
.markdownlint.yaml (or .jsonc, .json, .yml) and source.htmlhint reads
a .htmlhintrc, found in the book's folder or the nearest folder above it up
to the repository root. With no such file the check reports nothing.
Silencing a warning you have decided is fine
Some warnings are known false alarms for a particular book. Turn them off without disabling the whole check, either for the whole book or for one spot.
Whole book --- set the rule's level in checks, as above. off silences
it; warn or error changes its severity. The rule id is the one shown in
the warning: printsafe/... for CSS print-safety rules
(printsafe/no-risky-print-effects, printsafe/page-containment,
printsafe/preview-cannot-follow, printsafe/no-remote-urls), or the check id
for the rest (for example source.accessibility.heading-order). A finding's
code, shown with it, sets the level of that kind of finding alone and wins over
its check's level: raw_html: off drops raw HTML findings and keeps the rest of
the markdown check. An id that matches no rule is ignored, so a typo has no
effect --- check the spelling against the warning text.
One spot --- put a gp-check-disable-next-line comment on the line
directly above it. List several rules with commas, and add a reason after
--:
/* gp-check-disable-next-line printsafe/page-containment -- scoped by the rule below */
.page { overflow-x: clip; }
<!-- gp-check-disable-next-line source.accessibility.heading-order -- the example needs an h4 -->
#### Example heading
In markdown the comment works for every check and names a finding by its
check id or its code (raw_html); with no id it skips every check on that
line.
A section of markdown --- a comment cannot go between the rows of a table
(it ends the table), so skip a run of lines instead: every line from
gp-check-disable to gp-check-enable is left out of the Problems list.
Name rules the same way, or none to skip every check; gp-check-enable
ends every open run, and a run that is never ended goes to the end of the file.
<!-- gp-check-disable raw_html -- reviewed line breaks -->
| Tier | Effect |
|---|---|
| 1 | Heals 2 HP <br> once per scene |
<!-- gp-check-enable -->
Each comment is a block of its own, as above; in a code block or inside other
HTML it does nothing. A build that validates first (the default) leaves skipped
findings out of its log too.
(The desktop editor's CSS gutter honours the CSS comment too, but not checks;
the Problems panel honours both.)
Automatic Tool Detection
Most checks run in-process and never need an external tool. Only a few still probe for a system tool and warn if it is missing:
warn Tool "qpdf" not found; skipping: pdf.print.pdfx-markers, pdf.print.pdfx-metadata
warn Tool "gs" not found; skipping: pdf.print.ink-coverage
Everything else --- page size, safe margins, fonts, images/DPI, bookmarks, links, page labels, text density, color space, alpha, markdown/HTML linting --- runs with no system dependency, so you can validate immediately on any machine.
File Organization Best Practices
Recommended project structure
my-book/
├── manifest.yaml
├── 00-frontmatter/
│ ├── title.md
│ ├── credits.md
│ └── toc.md
├── 01-introduction.md
├── 02-chapter-one.md
├── 99-backmatter/
│ └── appendix.md
├── assets/
│ ├── images/
│ ├── fonts/
│ └── diagrams/
└── styles/
├── variables.css
└── custom.css
Naming conventions
Files: Number for explicit ordering (01-intro.md), descriptive names, all lowercase with hyphens.
Images: Include chapter prefix (ch03-combat-example.png), version suffix when needed (map-v2.png).
Production Workflow
1. Write and preview
gutterpress preview ./my-book
Keep the preview open in Chrome and edit source files. The browser reloads automatically on save.
2. Validate source
gutterpress validate --input ./my-book
Fix any pre-build issues --- missing alt text, broken links, oversized assets --- before building.
3. Build and validate PDF
gutterpress build ./my-book --format pdfx
This runs the full pipeline including both pre-build and post-build validation.
4. Preflight for submission
gutterpress preflight --pdf dist/my-book/my-book-pdfx.pdf --target dtrpg
Generates deterministic JSON and markdown reports suitable for archival or submission evidence.
Testing Checklist
Before final print submission:
- [ ] All images are at least 300 DPI
- [ ] All fonts embed correctly in the PDF
- [ ] Page size matches the printer's required trim size
- [ ] Bleed extends 0.125in beyond the trim edge on full-bleed pages
- [ ] Text stays at least 0.5in inside the trim, and art that does not bleed at least 0.25in from the outside edges (the two Safe area layers of the print overlays show both lines)
- [ ] No unexpected blank pages (the blank pages at the end of a
dtrpgbook are intentional) - [ ] Running headers are correct on all pages
- [ ] Page numbers start at the right page and run correctly
- [ ] Validate passes for every destination you publish to (
--target dtrpg,itch, or your book'spublish:list ---gutterpress publish --dry-runchecks them all)
Common Issues
Blank pages
Caused by excess @page markers. Audit your source files for unnecessary page breaks --- bare @page between short adjacent sections is the most common culprit.
Blank pages at the very end of a dtrpg book are expected: the build pads the
book to a multiple of 4 pages and keeps the last page empty for DriveThruRPG's
printer information. To turn that off, set print.reserveLastPage: false in
manifest.yaml. DriveThruRPG also accepts a book that is one page short of a
multiple of 4 and adds the last page itself; set print.lastPage: short-by-one
for that form (print.lastPage: blank is the default behaviour spelled out).
The preview shows the same pages the PDF gets.
Page break issues
- Don't force breaks unnecessarily
- Don't use
<br>tags for vertical spacing - Don't rely on specific pagination --- let flow happen naturally and use
@sectionto prevent unwanted breaks
Font issues
- A missing font is a build error naming the file --- check the
url(...)path in your CSS is correct and relative to that CSS file - Test on a clean machine to catch fonts that only happen to be installed locally
Color shift
Test the CMYK conversion before submitting to a printer. Adjust RGB values if colors look wrong in the converted output.