Skip to main content

Module page_errors

Module page_errors 

Source
Expand description

Per-page error detection for server/GUI mode.

Validates the problems a reader might care about for a single rendered page:

  1. Broken internal links — reuse OutboundLink data from LinkCache and resolve each through path_resolver::resolve_request_path.
  2. Broken media references — parse rendered HTML for <img>, <video>, <audio>, and <source> tags (plus Reveal.js data-background-* URLs on <section>) and confirm internal src attributes resolve when interpreted the way a browser would: relative to the page’s canonical URL, then through the same request pipeline the server uses. Checking never duplicates resolution logic, so it cannot disagree with what a live request actually serves.
  3. Unresolved wikilinks — literal [[...]] substrings that escaped transform_wikilinks (see src/wikilink.rs). Skipped inside <code> and <pre> blocks.
  4. Frontmatter parse errors — a YAML error discards the whole block, so otherwise-valid fields vanish; the captured message is surfaced verbatim.
  5. Relationship data problems — hierarchical (parent/child) cycles and endpoints that resolved through a name shared by several notes. Both are detected once per index rebuild (see src/relationships.rs) and only looked up here.
  6. Ambiguous body wikilinks — a [[Name]] several notes answer to, detected during the render (see src/wikilink_index.rs).

Designed to be cheap: each validator is a pure function and is expected to run on-demand for a single page render. The module is never invoked from src/build.rs, keeping static-site output untouched.

Structs§

MediaReference
A media reference in the rendered HTML that resolves to a real file on disk.
PageErrors
Response payload for GET /{page}/errors.json.

Enums§

MediaKind
Type of media element whose src attribute is broken.
PageError
A single problem detected on a page.

Functions§

ambiguous_relationship_endpoint_errors
Wraps the ambiguous relationship endpoints a page declared (from crate::relationships::RelationshipIndex::ambiguous_endpoints_for) into the page-error list.
ambiguous_wikilink_errors
Wraps the ambiguous body wikilinks found while rendering a page (from crate::markdown::MarkdownRenderResult::ambiguous_wikilinks) into the page-error list.
collect_media_references
Resolves every internal media reference in html to the file the server would actually serve, dropping the ones that do not resolve to a static file (those are already reported by validate_media_references).
contact_problem_errors
Wraps the unreadable contact-field entries found while parsing a contact note (from crate::markdown::MarkdownRenderResult::contact) into the page-error list.
detect_unresolved_wikilinks
Detects literal [[...]] strings left in the rendered HTML by failed wikilink transformation.
frontmatter_parse_errors
Wraps a captured YAML frontmatter parse error (from crate::markdown::MarkdownRenderResult::frontmatter_error) into the page-error list. Returns an empty vec when there was no error.
relationship_cycle_errors
Wraps the hierarchical relationship cycles a page is a member of (from crate::relationships::RelationshipIndex::cycles_for) into the page-error list.
validate_internal_links
Validates the internal outbound links for a single page.
validate_media_references
Validates <img>, <video>, <audio> and <source> src attributes in the rendered HTML.
validate_rendered_links
Validates every <a href> in the page’s rendered HTML.