pub struct ParsedBlock {Show 22 fields
pub spans: Vec<ParsedSpan>,
pub heading_level: Option<i64>,
pub list_style: Option<ListStyle>,
pub list_indent: u32,
pub list_prefix: String,
pub list_suffix: String,
pub list_start: Option<i64>,
pub marker: Option<MarkerType>,
pub is_code_block: bool,
pub code_language: Option<String>,
pub blockquote_depth: u32,
pub blockquote_opens: u32,
pub line_height: Option<i64>,
pub non_breakable_lines: Option<bool>,
pub page_break_before: Option<bool>,
pub front_matter: Option<bool>,
pub direction: Option<TextDirection>,
pub background_color: Option<String>,
pub alignment: Option<Alignment>,
pub top_margin: Option<i64>,
pub text_indent: Option<i64>,
pub semantic_role: Option<SemanticRole>,
}Expand description
A parsed block (paragraph, heading, list item, code block)
Default is an unformatted, empty paragraph — the shape a caller wants when
it has prose and no structure to give it. Deriving it also means a field
added later reaches those callers as “absent” rather than as a compile error
they would fix by guessing a value.
Fields§
§spans: Vec<ParsedSpan>§heading_level: Option<i64>§list_style: Option<ListStyle>§list_indent: u32§list_prefix: StringOrdered-list delimiter prefix (e.g. "(" for djot (1) lists; empty
otherwise). Stored on the List entity for round-trip fidelity.
list_suffix: StringOrdered-list delimiter suffix ("." for 1., ")" for 1)/(1);
empty for unordered lists).
list_start: Option<i64>The number the first item of the list this item belongs to wears, when it is not 1
(Djot and Markdown 3., HTML <ol start="3">). Every item of a list carries it.
Stored on the List entity.
marker: Option<MarkerType>Task-list checkbox marker (djot - [ ] / - [x]). Maps to
Block.fmt_marker. None for non-task blocks.
is_code_block: bool§code_language: Option<String>§blockquote_depth: u32§blockquote_opens: u32How many of the quotations the block stands in open at it, the innermost ones:
quotations as deep as the element’s before it but not the same ones. 0 when the
block goes on in the quotations the element before it stands in, as deep as it
stands. Two quotations one after the other (Djot and Markdown > a and > b with a
blank line between, HTML <blockquote> twice) were read as one, since the depth
alone does not tell them apart.
line_height: Option<i64>§non_breakable_lines: Option<bool>§page_break_before: Option<bool>Start this block on a new page (djot {page_break_before=true}). Maps to
Block.fmt_page_break_before. None when absent.
front_matter: Option<bool>This block opens the document as front matter (djot {front_matter=true}). Maps to
Block.fmt_front_matter. None when absent.
direction: Option<TextDirection>§background_color: Option<String>§alignment: Option<Alignment>Paragraph alignment (djot {alignment=left|right|center|justify}). Maps
to Block.fmt_alignment. None when no alignment attribute is present.
top_margin: Option<i64>This block’s own space-above (djot {top_margin=<int>}). Maps to
Block.fmt_top_margin and overrides the document-wide paragraph
spacing for this block alone. None when absent.
text_indent: Option<i64>This block’s own first-line indent (djot {text_indent=<int>}). Maps to
Block.fmt_text_indent and overrides the document-wide first-line
indent for this block alone. None when absent.
semantic_role: Option<SemanticRole>The enclosing blockquote’s semantic role (djot {semantic_role=epigraph}),
written on the quote’s first block because block attributes are the only channel
djot offers. The importer lifts it onto the Frame, where it belongs.
Implementations§
Source§impl ParsedBlock
impl ParsedBlock
Sourcepub fn is_inline_only(&self) -> bool
pub fn is_inline_only(&self) -> bool
Returns true when this block carries no block-level formatting,
meaning its content is purely inline.