pub struct Content<'src> { /* private fields */ }Expand description
Describes the annotated content of a block after any relevant substitutions have been performed.
This is typically used to represent the main body of block types that don’t
contain other blocks, such as SimpleBlock or RawDelimitedBlock.
§Deferred cross-references
Cross-references (<<id>>, xref:id[…]) cannot be resolved while a block
is being parsed, because their target may be defined later in the document
(or, for multi-document workflows, in another document entirely). The
macros substitution therefore records each cross-reference in a deferred
form and leaves an opaque placeholder in the rendered text. The
references are resolved in a later pass — see
Document::resolve_references — at which point rendered() reflects
the resolved links. Until then, rendered() shows an unresolved fallback,
so it always returns clean text.
Implementations§
Source§impl<'src> Content<'src>
impl<'src> Content<'src>
Sourcepub fn original(&self) -> Span<'src>
pub fn original(&self) -> Span<'src>
Returns the original span from which this Content was derived.
This is the source text before any substitions have been applied.
Sourcepub fn rendered(&'src self) -> &'src str
pub fn rendered(&'src self) -> &'src str
Returns the final text after all substitutions have been applied.
Sourcepub fn has_unresolved_refs(&self) -> bool
pub fn has_unresolved_refs(&self) -> bool
Returns true if this content contains one or more cross-references
that have not yet been resolved to a destination.