#[non_exhaustive]pub enum BlockNode {
Show 14 variants
Root {
children: Vec<BlockNode>,
span: Option<Span>,
},
Paragraph(Paragraph),
Heading {
level: u8,
children: Paragraph,
span: Option<Span>,
},
Blockquote {
children: Vec<BlockNode>,
span: Option<Span>,
},
Surface {
name: SharedString,
children: Vec<BlockNode>,
span: Option<Span>,
},
List {
children: Vec<BlockNode>,
ordered: bool,
start: Option<u32>,
span: Option<Span>,
},
ListItem {
children: Vec<BlockNode>,
spread: bool,
checked: Option<bool>,
task_marker: Option<Span>,
span: Option<Span>,
},
CodeBlock(CodeBlock),
Custom {
node: MarkdownNode,
state: BlockState,
},
Table(Table),
Break {
html: bool,
span: Option<Span>,
},
HorizontalRule {
span: Option<Span>,
},
Definition {
identifier: SharedString,
url: SharedString,
title: Option<SharedString>,
span: Option<Span>,
},
Unknown,
}Expand description
The block-level nodes.
This is the document tree TextView renders. Together with
editor_host it is also the hand-over type for
external editors: they build the tree, render it with
BlockNode::render and read geometry back per leaf.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Root
Something like a Div container in HTML.
Paragraph(Paragraph)
Heading
Blockquote
Surface
A blockquote opening with the marker of a
block surface, drawn inside
the container registered for name.
Its text, selection, highlights and reveals are its children’s, which leave out the marker line.
Fields
name: SharedStringThe name it is registered under, in ASCII lowercase.
List
Fields
ListItem
Fields
CodeBlock(CodeBlock)
Custom
A custom Markdown node produced by MarkdownExtensions.
Table(Table)
Break
HorizontalRule
Definition
Use for to_markdown get raw definition
Unknown
Implementations§
Source§impl BlockNode
impl BlockNode
Sourcepub fn render_with_id(
&self,
id: impl Into<ElementId>,
flow: FlowPosition,
render_context: &RenderContext,
window: &mut Window,
cx: &mut App,
) -> AnyElement
pub fn render_with_id( &self, id: impl Into<ElementId>, flow: FlowPosition, render_context: &RenderContext, window: &mut Window, cx: &mut App, ) -> AnyElement
Renders under a stable host-owned identity. Use a domain ID, not a list position, when inserting, reordering or virtualizing blocks. Identity scopes GPUI element state independently of the leaf keys used for geometry.
Sourcepub fn render(
&self,
ix: usize,
flow: FlowPosition,
cx: &RenderContext,
window: &mut Window,
app: &mut App,
) -> AnyElement
pub fn render( &self, ix: usize, flow: FlowPosition, cx: &RenderContext, window: &mut Window, app: &mut App, ) -> AnyElement
Renders the block as TextView does. ix identifies the block among
its siblings (element ids derive from it).
Trait Implementations§
impl StructuralPartialEq for BlockNode
Auto Trait Implementations§
impl !Freeze for BlockNode
impl !RefUnwindSafe for BlockNode
impl !UnwindSafe for BlockNode
impl Forget for BlockNode
impl Send for BlockNode
impl Sync for BlockNode
impl Unpin for BlockNode
impl UnsafeUnpin for BlockNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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