Function scalar
fn scalar(raw: &str) -> StringExpand description
One YAML scalar’s value, read from the text after its key.
The scan used to trim().trim_matches(['"', '\'']), which is right for a bare
or a quoted value and wrong for a commented one: site_url: https://… # the published base yielded the URL with the comment attached, and D41 bakes that
string into policy.site_base and thus into every self-hosted Rust link the
moment somebody runs --mode write. Nothing downstream could see it —
check-api-links resolves against the rustdoc tree rather than against the
site, and an external URL is invisible to mkdocs --strict (§1.3.152). The
option is documented in mkdocs.yml today with the comment above the key,
which is exactly why the bug was latent: moving it to the end of the line is an
ordinary edit.
Two YAML rules, and no more than these two:
- a quoted scalar ends at its closing quote, so a
#inside it is data; - in an unquoted scalar a
#opens a comment only when a space or tab precedes it (YAML 1.2 §6.6). A#that does not — the fragment in…/page/#anchor— is part of the value.