pub enum InlineNode {
Plain {
text: String,
annotations: Vec<Annotation>,
},
Strong {
content: InlineContent,
annotations: Vec<Annotation>,
},
Emphasis {
content: InlineContent,
annotations: Vec<Annotation>,
},
Code {
text: String,
annotations: Vec<Annotation>,
},
Math {
text: String,
annotations: Vec<Annotation>,
},
Reference {
data: ReferenceInline,
annotations: Vec<Annotation>,
},
}Expand description
Inline node variants supported by the initial flat inline parser.
All variants include an annotations field for attaching metadata. Post-processors
can populate this field when transforming inline content (e.g., parsing math to MathML).
Variants§
Plain
Plain text segment with no formatting.
Strong
Strong emphasis delimited by *.
Emphasis
Emphasis delimited by _.
Code
Inline code delimited by `.
Math
Simple math span delimited by #.
Reference
Reference enclosed by square brackets.
Implementations§
Source§impl InlineNode
impl InlineNode
Sourcepub fn strong(content: InlineContent) -> Self
pub fn strong(content: InlineContent) -> Self
Creates a strong node without annotations.
Sourcepub fn emphasis(content: InlineContent) -> Self
pub fn emphasis(content: InlineContent) -> Self
Creates an emphasis node without annotations.
Sourcepub fn reference(data: ReferenceInline) -> Self
pub fn reference(data: ReferenceInline) -> Self
Creates a reference node without annotations.
Sourcepub fn children(&self) -> Option<&InlineContent>
pub fn children(&self) -> Option<&InlineContent>
Returns nested inline content for container nodes (strong/emphasis).
Sourcepub fn annotations(&self) -> &[Annotation]
pub fn annotations(&self) -> &[Annotation]
Returns a reference to this node’s annotations.
Sourcepub fn annotations_mut(&mut self) -> &mut Vec<Annotation>
pub fn annotations_mut(&mut self) -> &mut Vec<Annotation>
Returns a mutable reference to this node’s annotations.
Sourcepub fn with_annotation(self, annotation: Annotation) -> Self
pub fn with_annotation(self, annotation: Annotation) -> Self
Adds an annotation to this node.
Sourcepub fn with_annotations(self, annotations: Vec<Annotation>) -> Self
pub fn with_annotations(self, annotations: Vec<Annotation>) -> Self
Adds multiple annotations to this node.
Trait Implementations§
Source§impl Clone for InlineNode
impl Clone for InlineNode
Source§fn clone(&self) -> InlineNode
fn clone(&self) -> InlineNode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InlineNode
impl Debug for InlineNode
Source§impl PartialEq for InlineNode
impl PartialEq for InlineNode
impl StructuralPartialEq for InlineNode
Auto Trait Implementations§
impl Freeze for InlineNode
impl RefUnwindSafe for InlineNode
impl Send for InlineNode
impl Sync for InlineNode
impl Unpin for InlineNode
impl UnsafeUnpin for InlineNode
impl UnwindSafe for InlineNode
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