Valkyrian Labs

Markdown Diagnostics

What the server checks at sync time, how to read the report, strict checks, and full checks.

Markdown Diagnostics

pmdocs validate checks the docs package (paths, frontmatter, limits) but cannot tell whether a page renders the way you meant: the native CLI has no Markdown renderer. The sync endpoint does. Every dry run and sync renders pages with payload-markdown, the renderer the docs pages use, and reports what it finds next to the plan.

What is checked

  • Renderer findings. Whatever payload-markdown reports for the page: an unknown theme on a directive (unknown-theme), an unclosed or stray directive, a directive marker inside a list item, a code block language that is not loaded, and so on. These come from payload-markdown unchanged (its source and code); pmdocs does not validate directives itself, so the checks always match the renderer version the site runs.

  • Links (broken_link). Each link is resolved exactly as the docs page serves it, after the page's link rewriting (relative ./ and ../ links, index.md, absolute links under the docs set), and must reach a page or file the docs set serves after this sync: a page, a synced asset, the generated llms.txt / llms-full.txt, or a skill zip. A link written to api-reference.md breaks when that page has slug: api: its route is /<set>/reference/api. For product-nested docs sets the message names the docs route.

  • Anchors (broken_anchor). A #fragment must match an element id on the target page: heading ids (duplicates numbered -1, -2), ids payload-markdown generates, and ids from raw HTML, which the renderer prefixes with user-content- (link to #user-content-<id>). A target page that this sync did not render is rendered before a fragment is reported.

  • References (unresolved-ref, payload-markdown's code). A :ref that names no entry or heading on its page, in the docs set after this sync, or in another published docs set (Cross-Page References).

External URLs (https:, mailto:, //host), images and routes of the site's other docs sets are not checked. A broken link that several references use is reported once.

The pages are rendered with the payload-markdown settings of the docs collection: plugin defaults and collection settings from payloadMarkdown(), and admin-managed palettes. If your docs page passes extra renderer options to PayloadMarkdownDocsPage (themes, palettes, code options), pass the same object to sync.diagnostics.renderer so the checks see what readers see (Sync config).

Reading the report

1pmdocs plan ./docs --source main-docs \2  --endpoint "$DOCS_SYNC_ENDPOINT" --key-id local-docs --private-key-env DOCS_SYNC_PRIVATE_KEY

pmdocs plan --endpoint asks the server for a dry-run plan (the same signed request as pmdocs push --dry-run). pmdocs push prints the same section after its summary:

1Diagnostics: 2 warnings, 1 info (changed pages, 3 of 75 pages checked)2 3guide/install.md:12:1 warning unknown-theme Unknown theme "warning" on "callout". Falling back to "soft".4guide/install.md:40:18 warning broken_anchor Link "#setp" goes to #setp, but this page has no element with that id.5 6reference/api.md:88:1 info code Code block language "nginx" is not loaded, so it is rendered as plain text. Add it to code.langs to highlight it.

One line per finding, grouped by file: path:line:col severity code message. Lines count from the top of the file, frontmatter included. Messages are capped at 300 characters, and pmdocs prints control characters from the server as ?. --json adds the server's report as diagnostics (counts, the pages checked, the scope, the strict verdict and every item) and diagnosticsFailed.

Findings never block a sync on their own. The same report is stored on the sync run, the docs set keeps the counts and the first few items (the Generated Docs panel shows them), and the docsSyncRuns MCP tool returns them.

Which pages are checked

A sync checks the pages it creates or changes (the changed pages scope). It checks every page (a full check) when:

  • you pass --full-check, for example after upgrading payload-markdown or changing themes;
  • strict checks apply, because a strict verdict covers the whole docs set;
  • the sync can break links in pages it does not change: a page is removed or its route moves, or a changed page loses a heading id that other pages may link to.

Rendering is quick (about two seconds for a 75-page docs set on an idle machine), so a full check is usually cheap. It still runs on the server that serves your site, so:

  • Every request has a render budget: 15 seconds of rendering and 500 pages by default (sync.diagnostics.budget.maxRenderMs and maxPages, Sync config). Changed pages are rendered first. Pages left when the budget runs out are counted as unchecked (pages.unchecked, and a check_budget_exhausted item: info normally, an error under strict checks, because a strict verdict needs every page).
  • One check at a time. A server process runs one diagnostics check at a time and queues the others, yielding to other requests between pages.
  • Pull requests do not get full checks. --full-check from a GitHub OIDC token minted for a pull request is ignored (the response lists checks.full under ignored, with a full_check_ignored info item) unless sync.diagnostics.allowFullCheckFromPullRequests is on. Strict checks from a pull request still check every page, within the budget.

Strict checks

1pmdocs push ./docs --source main-docs --endpoint "$DOCS_SYNC_ENDPOINT" \2  --key-id local-docs --private-key-env DOCS_SYNC_PRIVATE_KEY --strict

With strict checks, any warning or error (renderer findings, broken links and anchors) fails:

  • pmdocs push --strict: the server rejects the sync with diagnostics_failed before any doc, asset or docs set field is written, and pmdocs prints the findings and exits 1. A failed sync run with the findings is recorded, so the admin shows why CI failed.
  • pmdocs plan --endpoint ... --strict (or push --dry-run --strict): the plan is shown and pmdocs exits 1.
  • Info findings (such as a code language that is not loaded) never fail.
  • A failing strict dry run is recorded as a failed sync run.

To make every sync of a docs set strict, whichever client sends it, turn on Strict Markdown checks on the docs set (Sync tab). Older pmdocs versions then get the rejection with the findings listed as issues.

A strict request is sent as manifest version 2. Servers before payload-markdown-docs 1.4 accept only version 1, so they refuse it as an invalid manifest before doing anything, whatever the credentials: pmdocs reports diagnostics_unavailable and exits 1, and nothing was written. Requests without --strict stay version 1.

Plan, then push, with GitHub OIDC

Each GitHub OIDC token can be used once (the server rejects a reused token with oidc_replay). To run pmdocs plan --endpoint ... --strict before pmdocs push --strict in one job, use --github-oidc without --oidc-token-env: pmdocs then fetches a fresh token for each command from the Actions runtime. With --oidc-token-env, fetch one token per command. With Ed25519 keys every request is signed on its own. push --strict alone is enough to fail safely: the plan step only shows the findings earlier.

When the check itself fails

Nothing in the check takes a sync down. A page payload-markdown cannot render is reported as page_not_rendered, and a page whose links cannot be checked as link_check_failed; both are errors (so they fail strict checks), and the cause is logged on the server, never returned. A render failure that payload-markdown reports (render-failed) gets a generic message for the same reason. If payload-markdown/render cannot be loaded at all, the report has a diagnostics_unavailable error and no page is checked; the server logs that once. Turning diagnostics off (sync.diagnostics: false) reports Diagnostics: turned off on the server, and strict syncs are then rejected.