Preview

See documentation in your browser as you edit, then run an automated link and asset check on your machine.

Before you begin

  • Install the CLI or use npx @docs.page/cli
  • Page files or docs.json edits ready to review, see Write if you still need to create content

Run commands from the directory that contains docs.json. For more in-depth configuration, see CLI.


This page covers two local tasks before you continue to Publish:

  • Preview: open your docs in the browser and watch edits reload as you save files
  • Check: scan the project for broken links, missing assets, and invalid frontmatter targets

Preview while you edit so you can judge layout, navigation, and components. Run check when you want an automated pass over the whole site, it catches problems preview will not surface, such as a typo in a link on another page.

Local preview

  • Start from the folder that contains docs.json

    Open a terminal at your project root (the directory with docs.json).

  • See your docs in the browser

    bash
    npx @docs.page/cli preview

    The CLI watches docs.json (or docs.yaml) and docs/**/*.mdx, starts a WebSocket server on localhost, and opens your browser to a URL shaped like:

    text
    https://docs.page/preview?url=ws://localhost:57250

    The browser loads the production preview shell while file reads and bundling stay on your machine. Save a file under docs/ or update docs.json and the page reloads within a few seconds.

  • Override port or skip auto-open when needed

    bash
    npx @docs.page/cli preview --port 4000
    npx @docs.page/cli preview --no-browser

    Use --port when the default port is taken or you need a fixed number. Use --no-browser in remote development or when you want to copy the printed Preview URL manually.

  • Stop the preview server when finished

    Press Ctrl+C in the terminal when you are done.

Check links and assets

  • Catch link and asset problems automatically

    bash
    npx @docs.page/cli check

    By default, all categories report at error severity. The CLI validates internal links (paths to pages or assets in the repo), assets (images and files on disk), external links (reachable URLs), and frontmatter paths (redirect, next, and previous targets).

  • Fix every reported issue before you push

    Resolve typos in paths, missing files under docs/, broken external URLs, or invalid frontmatter targets. Re-run check after each fix. A clean run prints no error-level issues and exits with code 0.

  • Tune severity when external checks are noisy

    bash
    npx @docs.page/cli check --external-links warn --internal-links error --assets error

    Each of --external-links, --internal-links, and --assets accepts off, warn, or error. See CLI: check for defaults and exit codes.

When preview looks right and check exits with code 0, continue to Publish to share your changes on GitHub.

Troubleshooting

SymptomLikely causeFix
CLI exits before preview startsMissing docs.json, no docs/ directory, or no .mdx filesAdd the required files or run init
Browser shows a connection errorPreview server stopped or you opened an old URLRestart preview and open the newly printed Preview URL
Port already in useAnother process bound the portPass --port with a free port number
Preview looks staleEditor did not save the fileSave the file; confirm the terminal still shows the watcher running
Check reports a broken internal linkPath typo, wrong root-relative path, or file not yet addedUse paths like /authoring/preview, no domain and no .mdx extension. See Write: Links and assets
Check fails on redirect, next, or previousFrontmatter target does not match a real page pathFix the path or add the missing page. See Page frontmatter
External link failuresTarget blocks automated requests or is temporarily downFix the URL, or set --external-links warn or off for that run
Check passes locally but fails elsewhereA different working directory was checkedPass the correct [path] argument or run from the project root that contains docs.json

For more detail on both commands, see CLI.

Related

Publish
Publish

Share changes on GitHub and send branch previews to reviewers.

CLI
CLI

Flags, severities, exit codes, and error messages for every command.

Local preview
Local preview

How the preview shell works, what it watches, and what it does not include.

Search
Search

On-site ⌘K search: available on published sites, not in local preview.