pub struct DirectiveMark {
pub name: String,
pub attrs: Vec<(String, Option<String>)>,
pub label: String,
pub rows: usize,
}Expand description
The name and attributes a leaf directive’s placeholder row carries, so a
frontend that knows the host app’s vocabulary can paint the real thing —
an embedded page for diaryx’s ::embed{src=…}, a generated table of
contents for a ::toc, and the plain ⧉ name label for one it doesn’t
know. The peer of MediaMark, and plain strings for the same reason: they
survive the row shuffling of BlockCache reuse and build_spliced.
Fields§
§name: StringThe directive’s type — embed, toc, vis — with no leading colons.
Core is agnostic of what it means: the vocabulary is the host app’s.
attrs: Vec<(String, Option<String>)>Its {…} attributes as (key, value) pairs in source order. A bare
attribute ({public}) has a None value, the way twig reports it.
label: StringThe directive’s [label] text, flattened from its inline children, or
empty when it has none. Also what the placeholder label shows.
rows: usizeHow many visual rows this directive reserves — the label row plus blank
filler rows below it, so a frontend painting something real has the
vertical room. 1 is the bare placeholder, and what every directive
gets until a frontend that reserves rows — a terminal, which draws the
host’s lines over them — reports a height back through
crate::Doc::set_directive_rows, keyed by key. A
pixel-laid-out GUI sets its own height regardless.
Implementations§
Source§impl DirectiveMark
impl DirectiveMark
Sourcepub fn key(&self) -> DirectiveKey
pub fn key(&self) -> DirectiveKey
What crate::Doc::set_directive_rows knows this directive by.