Skip to main content

ElementKind

Enum ElementKind 

Source
pub enum ElementKind {
Show 18 variants Empty, Heading { level: u8, text: Vec<TextSegment>, section_id: usize, collapsed: bool, }, HeadingBorder { level: u8, }, CodeBlockHeader { language: String, blockquote_depth: usize, }, CodeBlockContent { content: String, highlighted: Option<Text<'static>>, line_number: usize, blockquote_depth: usize, }, CodeBlockBorder { kind: CodeBlockBorderKind, blockquote_depth: usize, }, Paragraph(Vec<TextSegment>), ListItem { depth: usize, ordered: bool, number: Option<usize>, content: Vec<TextSegment>, }, Blockquote { content: Vec<TextSegment>, depth: usize, }, TableRow { cells: Vec<String>, is_header: bool, alignments: Vec<ColumnAlignment>, }, TableBorder(TableBorderKind), HorizontalRule, Frontmatter { fields: Vec<(String, String)>, collapsed: bool, }, FrontmatterStart { collapsed: bool, context_id: Option<String>, }, FrontmatterField { key: String, value: String, }, FrontmatterEnd, Expandable { content_id: String, lines: Vec<MarkdownElement>, max_lines: usize, collapsed: bool, total_lines: usize, }, ExpandToggle { content_id: String, expanded: bool, hidden_count: usize, },
}
Expand description

Represents the kind of markdown element.

Variants§

§

Empty

Empty line (default).

§

Heading

Heading with level (1-6).

Fields

§level: u8
§section_id: usize

Unique section ID for tracking collapse state (index in elements vector).

§collapsed: bool

Whether this section is collapsed.

§

HeadingBorder

Border below heading.

Fields

§level: u8
§

CodeBlockHeader

Code block header with language.

Fields

§language: String
§blockquote_depth: usize

Blockquote nesting depth (0 = not in blockquote)

§

CodeBlockContent

Code block content line (plain text or syntax highlighted).

Fields

§content: String

Plain text content

§highlighted: Option<Text<'static>>

Syntax highlighted text (if available)

§line_number: usize

Line number (1-indexed)

§blockquote_depth: usize

Blockquote nesting depth (0 = not in blockquote)

§

CodeBlockBorder

Code block border (top, middle, bottom).

Fields

§blockquote_depth: usize

Blockquote nesting depth (0 = not in blockquote)

§

Paragraph(Vec<TextSegment>)

Paragraph text with formatting.

§

ListItem

List item with nesting level.

Fields

§depth: usize
§ordered: bool
§number: Option<usize>
§content: Vec<TextSegment>
§

Blockquote

Blockquote with nesting depth.

Fields

§content: Vec<TextSegment>
§depth: usize

Nesting depth (1 = single >, 2 = >> , etc.)

§

TableRow

Table row.

Fields

§cells: Vec<String>
§is_header: bool
§alignments: Vec<ColumnAlignment>
§

TableBorder(TableBorderKind)

Table border.

§

HorizontalRule

Horizontal rule.

§

Frontmatter

YAML frontmatter (collapsible) - legacy single-block format. Contains the parsed fields as key-value pairs.

Fields

§fields: Vec<(String, String)>

The frontmatter fields (key, value).

§collapsed: bool

Whether the frontmatter is collapsed (shows only context_id).

§

FrontmatterStart

Frontmatter top border with collapse icon.

Fields

§collapsed: bool

Whether the frontmatter section is collapsed.

§context_id: Option<String>

Context ID to show when collapsed (from frontmatter fields).

§

FrontmatterField

A single frontmatter field (key: value).

Fields

§key: String

The field key.

§value: String

The field value.

§

FrontmatterEnd

Frontmatter bottom border.

§

Expandable

Expandable content block (e.g., “Show more” / “Show less”).

Fields

§content_id: String

Unique ID for tracking state

§lines: Vec<MarkdownElement>

The content to display (already markdown elements)

§max_lines: usize

Maximum number of lines to show when collapsed

§collapsed: bool

Whether currently collapsed

§total_lines: usize

Total number of lines in the content

§

ExpandToggle

Show more / Show less toggle button.

Fields

§content_id: String

The content_id this toggle belongs to

§expanded: bool

Whether in expanded state (shows “Show less”) or collapsed (shows “Show more”)

§hidden_count: usize

Number of hidden lines

Trait Implementations§

Source§

impl Clone for ElementKind

Source§

fn clone(&self) -> ElementKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ElementKind

Source§

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

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

impl Default for ElementKind

Source§

fn default() -> ElementKind

Returns the “default value” for a type. 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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more