pub struct FootnoteRef {
pub label: String,
pub text: Option<String>,
pub offset: Option<usize>,
pub end: Option<usize>,
}Expand description
A footnote reference and the note it names — the answer to
Doc::footnote_at.
The two Options move together: a reference whose definition is missing has
neither a body to show nor a place to jump to, and one that resolved has
both.
Fields§
§label: StringThe reference’s label — the 1 of [^1], with neither the ^ that
spells it a footnote nor the brackets around it.
text: Option<String>The note’s body as source bytes (see
wysiwyg::footnote_body_span), or None when the
document defines no [^label]: to read one from.
offset: Option<usize>Where the note’s body starts, for a “go to note” that moves the caret
there. None alongside a None text.
The body rather than the definition, because this is an offset to put a
caret on and the [^1]: marker is decoration the caret can’t occupy —
aiming at the definition’s first byte snaps to the nearest real stop,
which is up in the paragraph above the note. It is also simply where a
reader following a reference wants to land: at the note’s first word,
ready to read or amend it.
end: Option<usize>Where the note’s body ends, exclusive — so a frontend can ask which
rendered rows the note occupies and draw those instead of text.
The rows are the note with its markup resolved: see *later* reaches a
frontend as an italic run, not as asterisks. text is the source bytes
and stays the honest answer for anything that wants the note as written
(a search index, a copy); this pair of offsets is for anything that wants
it as read. None alongside a None offset.
Trait Implementations§
Source§impl Clone for FootnoteRef
impl Clone for FootnoteRef
Source§fn clone(&self) -> FootnoteRef
fn clone(&self) -> FootnoteRef
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more