Skip to main content

strip_intra_doc_links

Function strip_intra_doc_links 

pub fn strip_intra_doc_links(
    generator: &'static str,
    text: &str,
) -> Result<String, Error>
Expand description

Rewrites rustdoc’s intra-doc links into plain text.

A doc comment links an item by its Rust path, which rustdoc resolves and a static site cannot: published as-is it becomes a link to a target that is not a URL, and mkdocs --strict is right to reject it. The label is kept, the unresolvable target is dropped, and a real URL is left alone. Turning these into deep links into the Rust reference is the api-links generator’s job, which owns the identifier → URL map; guessing the URLs here would be inventing structure the repository does not yet have.

Both rustdoc spellings are understood — [`Item`](path) and the prose-labelled [what it is](path), which M7.D8 met in atune_core::space::dsl’s grammar documentation. An ordinary Markdown link, whose target is a page or an anchor rather than a Rust path, is left exactly as written.

§Errors

Error::Unclassifiable on a link this function cannot classify — a code-span label pointing at a target that is neither a URL nor a Rust item path, or a path-shaped target that survives the rewrite. Fail-closed: a link is either understood or the run stops.