pub struct Capabilities {Show 20 fields
pub bold: bool,
pub italic: bool,
pub code: bool,
pub mark: bool,
pub underline: bool,
pub strike: bool,
pub superscript: bool,
pub subscript: bool,
pub heading: bool,
pub blockquote: bool,
pub bullet_list: bool,
pub ordered_list: bool,
pub task: bool,
pub link: bool,
pub image: bool,
pub thematic_break: bool,
pub footnote: bool,
pub code_language: bool,
pub table: bool,
pub cell_line_break: bool,
}Expand description
Which of leaf’s authoring controls this document’s format can actually spell — one flag per toolbar button, resolved once so a frontend can build its chrome instead of discovering each refusal on a click.
Every field but table is Format::supports on the gesture
the matching Doc method calls, so this record cannot drift from what the
ops do; table is [spells_pipe_tables], the one answer twig doesn’t
export.
The formats are ragged, and that is the point. A single per-document
boolean was enough while the two authorable formats were Markdown and djot
and everything else spelled nothing. HTML is neither: it writes seven of the
eight inline marks as a tag pair, plus <code>, <hr> and an in-cell
<br>, and spells no heading marker, no line prefix, no fence, no task box,
no link — because its versions of those have a different shape, not a
different alphabet. So ⌘B works in an HTML document and ⌘1 does not, and no
one flag can say that. Markdown and djot differ from each other too:
==mark== is djot-only, and an in-cell <br> is Markdown-only.
Fields§
§bold: bool⌘B — InlineKind::Strong.
italic: bool⌘I — InlineKind::Emph.
code: boolInline code — InlineKind::Verbatim.
mark: boolHighlight — InlineKind::Mark. Djot spells it; Markdown does not.
underline: bool⌘U — InlineKind::Insert, which every format that marks at all spells.
strike: boolStrikethrough — InlineKind::Delete.
superscript: bool§subscript: bool§heading: boolHeading levels and “make this a paragraph” — Doc::set_block.
blockquote: bool§bullet_list: bool§ordered_list: bool§task: boolThe checkbox controls: giving an item a box, and ticking one.
link: bool§image: boolCovers Doc::insert_media too — see the note there on why the three
media kinds stand or fall together.
thematic_break: boolThe horizontal-rule button. HTML spells this one (<hr>).
footnote: boolThe footnote button — Doc::insert_footnote. Markdown and djot spell
the pair; HTML has no footnote of its own, so the button goes away rather
than writing brackets that would render as brackets.
code_language: boolSetting a fenced block’s language — a control only ever offered with the caret already in a fence.
table: boolThe grid controls: insert/delete/move a row or column, set a column’s
alignment. Pair with Doc::caret_in_table, which asks the other
question — an HTML <table> holds the caret and still can’t be edited.
cell_line_break: boolShift+Return inside a cell. Markdown and HTML spell it; djot has no idiomatic in-cell break.
Implementations§
Trait Implementations§
Source§impl Clone for Capabilities
impl Clone for Capabilities
Source§fn clone(&self) -> Capabilities
fn clone(&self) -> Capabilities
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more