#[non_exhaustive]pub struct CrossReference<'a> {
pub target: &'a str,
pub target_is_local: bool,
pub text: Vec<InlineNode<'a>>,
pub location: Location,
pub xrefstyle: XrefStyle,
pub caption_label: XrefCaptionLabel<'a>,
pub role: Option<&'a str>,
/* private fields */
}Expand description
A CrossReference represents an inline cross-reference (xref) in a document.
Equality and debug output include target, text, location, xrefstyle,
caption_label, signifier, role, and target_is_local; parser-only state is excluded.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.target: &'a strThe effective link target. A resolved natural reference contains the matching ID; references to fully included sources contain the fragment ID. An empty local target addresses the document top. Unresolved references retain their reference text or fragment ID.
target_is_local: boolWhether target addresses this document, even when its ID is missing.
Set this together with target when changing a reference destination.
text: Vec<InlineNode<'a>>§location: Location§xrefstyle: XrefStyle§caption_label: XrefCaptionLabel<'a>§role: Option<&'a str>The role= of an xref: macro after attribute substitution and
passthrough restoration. It may be empty; HTML uses it as the link’s class.
Implementations§
Source§impl<'a> CrossReference<'a>
impl<'a> CrossReference<'a>
Sourcepub fn new(target: &'a str, location: Location) -> Self
pub fn new(target: &'a str, location: Location) -> Self
Creates a new CrossReference with the given target. Bare IDs default
to local targets; paths with extensions or schemes default to external.
Set target_is_local explicitly for an ID that resembles a filename.
Sourcepub fn with_text(self, text: Vec<InlineNode<'a>>) -> Self
pub fn with_text(self, text: Vec<InlineNode<'a>>) -> Self
Sets the cross-reference display text as inline nodes.
Sourcepub const fn signifier(&self) -> XrefSignifier<'a>
pub const fn signifier(&self) -> XrefSignifier<'a>
The word before a section number, using the attributes at this reference’s
source position unless overridden by Self::set_signifier.
Sourcepub fn set_signifier(&mut self, signifier: XrefSignifier<'a>)
pub fn set_signifier(&mut self, signifier: XrefSignifier<'a>)
Override the section signifier, including after subsequent calls to
Document::renumber_sections.