Preview as different readers
Serve the docs on your machine, rebuilding on save, and see exactly what each kind of reader gets.
About this task
The previewer uses the same build, filter and renderer as hosted delivery. "Preview as" is the real reader filter, not an approximation, so if a paragraph shows for a reader here, it shows for that reader in production.
-
Start the previewer on your docs folder.
pnpm opend preview path/to/docsIt prints any problems, then Serving http://127.0.0.1:4000/ (watching for changes). Open that address. Pages reload when you save a file.
-
Look at the staff view.
With no reader options the previewer shows everything that survives the build-time filter, and marks each conditional element with its attributes, such as
product=embed. Every alternative of a conditional key is shown, separated by a bar. Readers never see these markers. -
Switch reader with Preview as in the banner at the top of each page.
The list holds the readers in
preview-contexts.yaml. The choice is kept in a cookie, so it sticks while you browse. The banner also shows the reader's products, features and version, and a summary of any validation problems. -
Or start the previewer as a particular reader.
--as adminpicks a named reader frompreview-contexts.yaml.--product core,embed --feature early-access --version 0.1describes a reader on the command line.--versiondefaults to the project's release.--allis the staff view, the default.
-
Optional: preview a release branch or tag without checking it out.
pnpm opend preview path/to/docs --ref v1A git ref is read once and not watched.
Results
Besides the pages, the previewer serves a few helper pages:
/search?q=…- The search box in the page header: the current reader's pages that match, searched in memory. See Search the docs.
/_opend/publications- Every PDF publication, and whether the current reader can see anything in it.
/pdf/<name>.pdfand/pdf/<name>.html- A publication printed for the current reader, and its print HTML.
/_opend/help-lab- What every context-sensitive help key and route resolves to. See Check context help in the help lab.
/_opend/diagnostics.json- The current validation problems as JSON.
What to do next
To add your own sample readers, see preview-contexts.yaml reference.