Enum crowbook::Token
[−]
[src]
pub enum Token { Str(String), Paragraph(Vec<Token>), Header(i32, Vec<Token>), Emphasis(Vec<Token>), Strong(Vec<Token>), Code(Vec<Token>), BlockQuote(Vec<Token>), CodeBlock(String, Vec<Token>), Superscript(Vec<Token>), Subscript(Vec<Token>), List(Vec<Token>), OrderedList(usize, Vec<Token>), Item(Vec<Token>), Table(i32, Vec<Token>), TableHead(Vec<Token>), TableRow(Vec<Token>), TableCell(Vec<Token>), Footnote(Vec<Token>), Rule, SoftBreak, HardBreak, Link(String, String, Vec<Token>), Image(String, String, Vec<Token>), StandaloneImage(String, String, Vec<Token>), Annotation(Data, Vec<Token>), // some variants omitted }
A single token representing a Markdown element.
A Markdown document is, thus, a Vec of Token
s.
This Enum might grow additional variants, so library users should not rely on exhaustive matching.
Variants
Str(String)
The most simple element, containing a String
Paragraph(Vec<Token>)
A paragraph, containing a list of elements
Header(i32, Vec<Token>)
A header with a header number and the title
Emphasis(Vec<Token>)
Emphasis, a.k.a. italics
Strong(Vec<Token>)
Strong, a.k.a. bold
Code(Vec<Token>)
Code
, a.k.a. verbatim
BlockQuote(Vec<Token>)
A quote
CodeBlock(String, Vec<Token>)
Code block with language and content
Superscript(Vec<Token>)
Superscript, indicated with ...^
Subscript(Vec<Token>)
Subscript, indicated with ~...~
List(Vec<Token>)
Unordered list, with a vector of Item
s
OrderedList(usize, Vec<Token>)
Ordered list, with a starting number, and a list of Item
s
Item(Vec<Token>)
Item of a list
Table(i32, Vec<Token>)
Table with number of rows, and a list of TableHead
and TableRows
TableHead(Vec<Token>)
Table header, contains TableCell
s
TableRow(Vec<Token>)
Row of a table, contains TableCell
s
TableCell(Vec<Token>)
Cell of a table
Footnote(Vec<Token>)
A footnote, contains the content it is pointing to.
Rule
Horizontal rule
SoftBreak
Softbreak, usually rendered by a space
HardBreak
Hardbreak
Link(String, String, Vec<Token>)
A link with an url, a title, and the linked text
Image(String, String, Vec<Token>)
An image with a source url, a title and an alt tex
StandaloneImage(String, String, Vec<Token>)
Similar to previous, but when image is in a standalone paragraph
Annotation(Data, Vec<Token>)
An annotation inserted by crowbook for e.g. grammar checking
Methods
impl Token
[src]
fn inner(&self) -> Option<&[Token]>
[src]
Returns the inner list of tokens contained in this token (if any)
fn inner_mut(&mut self) -> Option<&mut Vec<Token>>
[src]
Returns the inner list of tokens contained in this token (if any) (mutable version)
fn is_str(&self) -> bool
[src]
Checks whether token is an str
fn is_image(&self) -> bool
[src]
Checks whether token is an image
Returns true
if and only if token is Image variant
(StandaloneImage returns false, like other variants)
fn is_header(&self) -> bool
[src]
Checks whether token is a header.
Returns true
if and only if token is Header variant.
fn is_code(&self) -> bool
[src]
Returns true if token is code or code block
fn is_container(&self) -> bool
[src]
Returns true if token is a container (paragraph, quote, code block, code, emphasis, ..., but not links, images, and so on).
Trait Implementations
impl Debug for Token
[src]
impl PartialEq for Token
[src]
fn eq(&self, __arg_0: &Token) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Token) -> bool
[src]
This method tests for !=
.