pub struct Highlight {
pub start: usize,
pub end: usize,
pub id: String,
pub color: Option<String>,
pub marker: Option<String>,
}Expand description
A host-painted range of the source — an annotation’s footprint, a search
hit, a reviewer’s mark. Leaf renders it (a background wash behind the
glyphs whose source falls inside it) and hands back the id when the
reader activates it; what the range means is entirely the host’s.
Ranges are source bytes, like the caret and the selection, so a host that
anchors quotes against the source (Doc::selection_quote is the other
half of that loop) can paint what it found without any coordinate
conversion. A range that drifts off the text it meant is the host’s to
re-anchor; leaf draws what it is told.
Fields§
§start: usizeByte offset in the source where the wash begins.
end: usizeByte offset where it ends (exclusive).
id: StringThe host’s name for it, handed back on activation. Opaque to leaf.
color: Option<String>A rendering hint the frontend maps — a #RRGGBB hex string, or
nothing for the theme’s default wash.
marker: Option<String>A margin glyph’s name, or nothing for wash-only ink. A highlight with a marker gets a small glyph in the margin beside its first line, and the glyph — not the wash — is what activates it: the wash is ink, the marker is the control, which is what lets a reader put a caret in (or copy from) annotated text without a card leaping at them. The name is opaque to leaf; an Apple frontend reads it as an SF Symbol, a web one as a class.