Skip to main content

ParsedBlock

Struct ParsedBlock 

Source
pub struct ParsedBlock {
Show 19 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 marker: Option<MarkerType>, pub is_code_block: bool, pub code_language: Option<String>, pub blockquote_depth: u32, pub line_height: Option<i64>, pub non_breakable_lines: Option<bool>, pub page_break_before: 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)

Fields§

§spans: Vec<ParsedSpan>§heading_level: Option<i64>§list_style: Option<ListStyle>§list_indent: u32§list_prefix: String

Ordered-list delimiter prefix (e.g. "(" for djot (1) lists; empty otherwise). Stored on the List entity for round-trip fidelity.

§list_suffix: String

Ordered-list delimiter suffix ("." for 1., ")" for 1)/(1); empty for unordered lists).

§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§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.

§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

Source

pub fn is_inline_only(&self) -> bool

Returns true when this block carries no block-level formatting, meaning its content is purely inline.

Trait Implementations§

Source§

impl Clone for ParsedBlock

Source§

fn clone(&self) -> ParsedBlock

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ParsedBlock

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.