Enum crowbook::Token [] [src]

pub enum Token {
    Str(String),
    Paragraph(Vec<Token>),
    Header(i32Vec<Token>),
    Emphasis(Vec<Token>),
    Strong(Vec<Token>),
    Code(Vec<Token>),
    BlockQuote(Vec<Token>),
    CodeBlock(StringVec<Token>),
    Superscript(Vec<Token>),
    Subscript(Vec<Token>),
    List(Vec<Token>),
    OrderedList(usizeVec<Token>),
    Item(Vec<Token>),
    Table(i32Vec<Token>),
    TableHead(Vec<Token>),
    TableRow(Vec<Token>),
    TableCell(Vec<Token>),
    Footnote(Vec<Token>),
    Rule,
    SoftBreak,
    HardBreak,
    Link(StringStringVec<Token>),
    Image(StringStringVec<Token>),
    StandaloneImage(StringStringVec<Token>),
    Annotation(DataVec<Token>),
    // some variants omitted
}

A single token representing a Markdown element.

A Markdown document is, thus, a Vec of Tokens.

This Enum might grow additional variants, so library users should not rely on exhaustive matching.

Variants

The most simple element, containing a String

A paragraph, containing a list of elements

A header with a header number and the title

Emphasis, a.k.a. italics

Strong, a.k.a. bold

Code, a.k.a. verbatim

A quote

Code block with language and content

Superscript, indicated with ...^

Subscript, indicated with ~...~

Unordered list, with a vector of Items

Ordered list, with a starting number, and a list of Items

Item of a list

Table with number of rows, and a list of TableHead and TableRows

Table header, contains TableCells

Row of a table, contains TableCells

Cell of a table

A footnote, contains the content it is pointing to.

Horizontal rule

Softbreak, usually rendered by a space

Hardbreak

A link with an url, a title, and the linked text

An image with a source url, a title and an alt tex

Similar to previous, but when image is in a standalone paragraph

An annotation inserted by crowbook for e.g. grammar checking

Methods

impl Token
[src]

[src]

Returns the inner list of tokens contained in this token (if any)

[src]

Returns the inner list of tokens contained in this token (if any) (mutable version)

[src]

Checks whether token is an str

[src]

Checks whether token is an image

Returns true if and only if token is Image variant (StandaloneImage returns false, like other variants)

[src]

Checks whether token is a header.

Returns true if and only if token is Header variant.

[src]

Returns true if token is code or code block

[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]

[src]

Formats the value using the given formatter.

impl PartialEq for Token
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Clone for Token
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more