pub enum Token<'a> {
Show 22 variants Plaintext(String), Header(usize, String, Option<String>), UnorderedListEntry(Vec<Token<'a>>), OrderedListEntry(String), Italic(String), Bold(String), BoldItalic(String), LineBreak, Newline, HorizontalRule, Tab, DoubleTab, Strikethrough(String), Code(String), CodeBlock(String, String), BlockQuote(u8, String), Image(String, Option<String>), Link(ValidURL<'a>, Option<String>, Option<String>), Detail(String, Vec<Token<'a>>), Table(Vec<(Alignment, String)>, Vec<Vec<(Alignment, Vec<Token<'a>>)>>), TaskListItem(TaskBox, String), Footnote(String, String),
}
Expand description

Tokens are the intermediate representation format in the markdown to html conversion

Variants§

§

Plaintext(String)

String: Body of unstructured text

§

Header(usize, String, Option<String>)

u8: Header level (1..=6). str: Header text. Option: html label

§

UnorderedListEntry(Vec<Token<'a>>)

str: Text for list entry

§

OrderedListEntry(String)

str: Text for list entry

§

Italic(String)

str: Text to be italicized

§

Bold(String)

str: Text to be bolded

§

BoldItalic(String)

str: Text to be bolded and italicized

§

LineBreak

Corresponds to a
html tag

§

Newline

Corresponds to a newline character

§

HorizontalRule

Corresponds to a


html tag

§

Tab

Used for control flow. Not directly rendered

§

DoubleTab

Used for control flow. Not directly rendered

§

Strikethrough(String)

str: Text to be struck through

§

Code(String)

str: Text to be placed within an inline code tag. eg. str

§

CodeBlock(String, String)

First str: Text to be placed within a multi-line code tag. Second str: Language

§

BlockQuote(u8, String)

u8: Block quote level. str: Block quote text

§

Image(String, Option<String>)

str: Link. Option: Title for link.

str: Link. First Option: Title for link. Second Option: Hover text

§

Detail(String, Vec<Token<'a>>)

str: Summary. Vec: Tokens to be rendered in the collapsable section

§

Table(Vec<(Alignment, String)>, Vec<Vec<(Alignment, Vec<Token<'a>>)>>)

Tuple of Vec<(Alignment, str)>: Which defines the table header and Vec<Vec<(Alignment, Vec)>> which defines the rows

§

TaskListItem(TaskBox, String)

TaskBox: Boolean state of the checked or unchecked box. str: List item text

§

Footnote(String, String)

First str: Reference id. Second str: Reference text

Trait Implementations§

source§

impl<'a> Debug for Token<'a>

source§

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

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

impl<'a> Display for Token<'a>

source§

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

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

impl<'a> PartialEq<Token<'a>> for Token<'a>

source§

fn eq(&self, other: &Token<'a>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> Eq for Token<'a>

source§

impl<'a> StructuralEq for Token<'a>

source§

impl<'a> StructuralPartialEq for Token<'a>

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Token<'a>

§

impl<'a> Send for Token<'a>

§

impl<'a> Sync for Token<'a>

§

impl<'a> Unpin for Token<'a>

§

impl<'a> UnwindSafe for Token<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. 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 Twhere 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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.