pub enum Node {
Show 19 variants
Paragraph {
children: Vec<Node>,
},
Heading {
level: u8,
children: Vec<Node>,
},
BulletList {
items: Vec<Node>,
},
OrderedList {
start: u32,
items: Vec<Node>,
},
ListItem {
checked: Option<bool>,
children: Vec<Node>,
},
Table {
align: Vec<Align>,
rows: Vec<Vec<TableCell>>,
},
BlockQuote {
children: Vec<Node>,
},
ThematicBreak,
CodeBlock {
lang: Option<String>,
code: String,
},
Code {
code: String,
},
Emphasis {
children: Vec<Node>,
},
Strong {
children: Vec<Node>,
},
Strikethrough {
children: Vec<Node>,
},
Link {
href: String,
children: Vec<Node>,
},
InternalLink {
href: String,
children: Vec<Node>,
},
Image {
src: String,
alt: String,
},
SoftBreak,
LineBreak,
Text {
value: String,
},
}Expand description
One node of parsed markdown.
Shaped for a client to walk and turn into DOM nodes directly — every
variant is either a container (children, or for a list or table, a
nested collection) or a leaf that carries exactly the data needed to
build one element. There is no HTML anywhere in this type; see the module
documentation for the two places that turn attacker-controlled markup
into plain Node::Text instead of a live link or image.
Variants§
Paragraph
A paragraph.
Heading
A heading.
BulletList
An unordered (bullet) list.
Fields
items: Vec<Node>The list’s items. Always Node::ListItem.
OrderedList
An ordered (numbered) list.
Fields
items: Vec<Node>The list’s items. Always Node::ListItem.
ListItem
One item of a list, or of a GFM task list.
Fields
Table
A GFM table.
Fields
BlockQuote
A block quote.
ThematicBreak
A horizontal rule (---).
CodeBlock
A fenced or indented code block.
Never syntax-highlighted: magi does not add a highlighting
dependency, so lang is carried only as a label for the client to
show, not as a hint the server has already acted on.
Fields
Code
An inline code span.
Emphasis
Emphasized (*italic*) inline content.
Strong
Strongly emphasized (**bold**) inline content.
Strikethrough
Struck-through (~~text~~) inline content.
Link
A link. Only ever produced for an http:/https: destination; any
other scheme becomes Node::Text instead, see [normalize_link].
InternalLink
An application route verified against the server’s stores, never a destination supplied by Markdown.
Fields
Image
An image. Only ever produced for a data: image URI or a resolved
question panel asset; anything else becomes Node::Text instead,
see [normalize_image].
SoftBreak
A soft line break: a single newline in the source, conventionally rendered as a space or an ordinary wrap.
LineBreak
A hard line break: two trailing spaces, or a trailing backslash, in the source.
Text
Plain text.
Also stands in for anything to_nodes refuses to render as markup:
raw HTML from the source, a link with a disallowed scheme, an image
with a disallowed source.
Trait Implementations§
impl StructuralPartialEq for Node
Auto Trait Implementations§
impl Forget for Node
impl Freeze for Nodewhere
*const u8 is !null: Freeze,
PhantomData<Node>: Freeze,
PhantomData<Align>: Freeze,
PhantomData<Vec<TableCell>>: Freeze,
PhantomData<u8>: Freeze,
impl Move for Node
impl RefUnwindSafe for Node
impl Send for Nodewhere
RawVecInner: Send,
impl Sync for Nodewhere
RawVecInner: Sync,
impl Unpin for Node
impl UnsafeUnpin for Nodewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<Node>: UnsafeUnpin,
PhantomData<Align>: UnsafeUnpin,
PhantomData<Vec<TableCell>>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
impl UnwindSafe for Nodewhere
RawVecInner: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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