module

Plombir::Check::Html

Shared HTML helpers for the output-based checkers (links, assets, SEO): reference extraction plus resolving hrefs against the built dist/ tree with server-identical semantics.

Links owns <a href> navigation; assets owns embedded resources (img/script/link/source) — a reference reports in exactly one section.

Constants

LINK = /<a\b[^>]*href\s*=\s*["']([^"']*)["']/i

Navigable links.

RESOURCE = /<(?:img|script|link|source)\b[^>]*(?:href|src)\s*=\s*["']([^"']*)["']/i

Embedded resources.

Class methods

internal?(reference : String) : Bool

True for links check must resolve: same-site paths. Skips schemes (https:, mailto: …), protocol-relative URLs, and pure fragments.

Source
line_of(file : String, needle : String) : Int32 | Nil

1-based line containing needle in file, if any.

Source
resolve(reference : String, page_output : String) : String | Nil

Resolves an internal reference from the page at page_output (dist-relative, e.g. "posts/a/index.html) to a dist-relative target file, or nil when it escapes dist/. Root-relative references anchor at dist/; relative ones at the page's directory. Query strings and fragments are dropped.

Source
resources(html : String) : Array(String)

Every href/src on embedded resources, in document order.

Source
served?(dist : String, target : String) : Bool

True when target (dist-relative, from .resolve) serves under dist, mirroring the dev server exactly: a file, or a directory carrying index.html. Anything else 404s in dev/preview, so check flags it.

Source