pub enum MarkupMode {
None,
Shortcuts,
Full,
}Expand description
How much of the source markup the WYSIWYG view exposes — a per-editor
preference, orthogonal to View. Named for markup rather than for Markdown
because leaf is grammar-agnostic: twig hands it Djot, HTML and XML on the same
terms, and every rung below is about delimiters, whatever grammar spells
them. The examples are Markdown only because that is what most documents are.
A single ladder over two underlying axes, because only three of their four combinations are coherent:
The empty quadrant would show delimiters on the caret’s line and then escape
the ones you type — a surface that displays a syntax it refuses to accept.
Someone who wants to read raw markup without authoring it has
View::Source, which is the better tool for it.
The two axes are read separately by the code that cares — see
reveals_caret_line and
authors — so neither behaviour has to know it’s spelled
as a ladder.
Variants§
None
Delimiters stay hidden even on the caret’s line, and typed syntax stays literal — twig escapes anything that would open markup, so formatting comes from commands (⌘b, the toolbar) instead of from spelling. The clean reading surface for people who don’t write markup by hand; the default, and what Diaryx ships.
Shortcuts
Delimiters stay hidden, but typing them authors real markup: *x*
becomes italic and the asterisks disappear into the styling
(Typora/Bear-shaped). For someone who knows the syntax but wants the
clean surface back once it has been applied.
Full
The caret’s line shows its raw markup while every other line renders resolved (Obsidian live-preview-shaped), and typed syntax authors markup — for people fluent in the document’s grammar who want to see and edit the delimiters they type.
Implementations§
Source§impl MarkupMode
impl MarkupMode
Sourcepub fn reveals_caret_line(self) -> bool
pub fn reveals_caret_line(self) -> bool
Whether the rich view shows raw delimiters on the line holding the caret.
The rendering axis — read by Doc::reveal_line and threaded into the
WYSIWYG builder.
Whether typed markup characters author real formatting. The editing axis
— read by Doc::insert, which escapes typed syntax when this is false.
Trait Implementations§
Source§impl Clone for MarkupMode
impl Clone for MarkupMode
Source§fn clone(&self) -> MarkupMode
fn clone(&self) -> MarkupMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more