pub enum BlockClass {
Paragraph,
Heading,
List,
ListItem,
Quote,
Code,
Table,
Media,
Directive,
Rule,
Footnote,
Other,
}Expand description
The block kinds core tells apart when it walks a document — the vocabulary
Boundary is spelled in. A statement about structure, not about how any
of it should look: what a frontend does with “this gap sits above a heading”
is entirely the frontend’s.
Class rather than Kind because twig::BlockKind already means
something else in this crate’s public surface — the command vocabulary
(Paragraph | Heading(n)) a toolbar passes to Doc::set_block.
This is the reverse direction: what a block already is, read back off a
rendered row.
BlockClass::Other is the honest answer for a node kind core doesn’t
separate out, so adding one here is additive for every frontend: nothing has
to change until it wants to space that kind differently.
Variants§
Paragraph
Heading
List
A whole list. Its items are BlockClass::ListItem; note that core
draws no boundary row between two items of one list, tight or loose, so
an item↔item pair never reaches a frontend.
ListItem
Quote
Code
Table
Media
A block-level image, video, or audio.
Directive
A :::name{.class} directive container.
Rule
Footnote
Other
Implementations§
Source§impl BlockClass
impl BlockClass
Sourcepub fn from_node_kind(kind: &Kind) -> BlockClass
pub fn from_node_kind(kind: &Kind) -> BlockClass
Classify a twig node kind — the same vocabulary [Builder::block]
matches on, so the two can’t drift about what a block is. Both the
whole-arena walk (which has FlatNodes) and the incremental top-level
walk (which has only a query match’s kind) reach it by this one door.
Trait Implementations§
Source§impl Clone for BlockClass
impl Clone for BlockClass
Source§fn clone(&self) -> BlockClass
fn clone(&self) -> BlockClass
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more