Struct outline::parser::html::HtmlParser

source ·
pub struct HtmlParser {
    pub code_tag: String,
    pub language_attribute: String,
    pub name_attribute: String,
    pub block_class: String,
    pub language_class: String,
    pub comments_as_aside: bool,
    pub default_language: Option<String>,
    pub comment_start: String,
    pub interpolation_start: String,
    pub interpolation_end: String,
    pub macro_start: String,
    pub macro_end: String,
}
Expand description

The config for parsing an HTML document

Fields

code_tag: String

The tag that code is written in when parsing. When printing, the code is always rendered in <pre><code></code></pre>, as is recommended by W3C.

Default: code

language_attribute: String

The attribute to put the language name when rendering the documentation.

Default: data-language

When parsing, the language is always read from the language attribute (this value is ignored).

name_attribute: String

The attribute to add to the code_tag with the code block’s name .

Default: data-name

When parsing, the name is always read from the name attribute (this value is ignored)

block_class: String

A class to add to the <pre> container for any parsed blocks of code when rendering.

language_class: String

The class to add to the <code> block when rendering. The string {} is replaced with the language that this block is in.

Default: language-{}

comments_as_aside: bool

Parsed comments are stripped from the code and written to an <aside></aside> block after the code when printing. If false, the comments are just written back into the code.

Default: false

default_language: Option<String>

The language to set if there was no automatically detected language. Optional

comment_start: String

The sequence to identify a comment which should be omitted from the compiled code, and may be rendered as an <aside> if comments_as_aside is set.

Default: //

interpolation_start: String

The sequence to identify the start of a meta variable interpolation.

Default: @{

interpolation_end: String

The sequence to identify the end of a meta variable interpolation.

Default: }

macro_start: String

The sequence to identify the start of a macro invocation.

Default: ==>

macro_end: String

The sequence to identify the end of a macro invocation.

Default: .

Implementations

Creates a default parser with a fallback language

Sets the default language of this parser (or does nothing if None is passed)

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
The type of error for this parser
Parses the text part of the document. Should delegate the code section on a line-by-line basis to the built in code parser. Read more
Parses a macro name, returning the name and the extracted variables
Parses a line as code, returning the parsed Line object
The token to denote the start of a comment that should be rendered in the documentation. This may be specified as the actual line comment symbol used by the source language to exclude all comments from the transpiled file, or it can be a completely separate symbol to allow for some comments to be left untouched even in the output files. Read more
The token to denote the start of a meta-variable interpolation
The token to denote the end of a meta-variable interpolation
The token to denote the start of a macro invocation
The token to denote the end of a macro invocation
Prints a text block
Prints a code block
Fills a name with its placeholders
Prints a line of a code block

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.