Skip to main content

MarkdownBlock

Struct MarkdownBlock 

Source
pub struct MarkdownBlock {
    pub kind: MarkdownBlockKind,
    pub text: String,
    pub quote_depth: u8,
    pub list_depth: u8,
    pub marker: ListStyle,
    pub blank_before: bool,
}
Expand description

One leaf block of a Markdown document, with the containers around it flattened into depths: a paragraph inside a list item inside a quote is one block with quote_depth == 1 and list_depth == 1.

Flat, because a view lays a document out as a column of rows and updates it row by row. A nested tree would make “the last row changed” a walk through every enclosing container.

Fields§

§kind: MarkdownBlockKind§text: String

Inline Markdown for a paragraph or heading (give it to parse), the literal code for a code block, empty for a rule.

§quote_depth: u8

How many block quotes enclose this block.

§list_depth: u8

How many list items enclose this block: 0 outside a list, 1 in a top-level item.

§marker: ListStyle

The marker to draw beside this block: Bullet or Ordered(n) on the first block of a list item, None everywhere else (a second paragraph in the same item, text outside a list). An ordered list counts up from the number its first item was written with.

§blank_before: bool

A blank line separated this block from the one before it. A view uses it to tell a tight list from a loose one.

Trait Implementations§

Source§

impl Clone for MarkdownBlock

Source§

fn clone(&self) -> Self

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 MarkdownBlock

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for MarkdownBlock

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MarkdownBlock

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.