pub struct BodyLink {
pub kind: BodyLinkKind,
pub raw: String,
pub target: String,
pub heading: Option<String>,
pub block: Option<String>,
pub alias: Option<String>,
pub size: Option<Size>,
pub byte_start: usize,
pub byte_end: usize,
}Expand description
One outgoing reference found in a body, with its span, before resolution.
Separate from a resolved link because extraction and resolution have different lifetimes: a note’s links change when the note is edited, and what they resolve to changes when any other note in the vault is created or renamed. A caller that caches the first and recomputes the second needs them to be two types.
Fields§
§kind: BodyLinkKindWhich syntax produced the link.
raw: StringThe reference as written between the delimiters, with any code inside it blanked to spaces.
target: StringWhat resolution runs against. A wikilink’s raw minus #heading /
^block / |alias and the \ escaping the pipe; a markdown link’s URL
percent-decoded and minus a trailing .md. Empty for a link to the
note it is written in (see ScanOptions::self_links).
heading: Option<String>A wikilink’s #heading, as crate::WikiLink::heading. None for a
markdown link.
block: Option<String>A wikilink’s #^block, as crate::WikiLink::block. None for a
markdown link.
alias: Option<String>A wikilink’s or embed’s |alias: the text after the first | outside
code, read from the body so code inside it is kept. None when there
is none or it is empty, and for a markdown link.
size: Option<Size>An embed’s size, |300 or |300x200, as crate::WikiLink::size.
byte_start: usizeByte offset within the body where the whole link syntax starts. An
embed’s leading ! is inside it.
byte_end: usizeByte offset within the body just past the end of the link syntax.