BodyElementDirective

Enum BodyElementDirective 

Source
pub enum BodyElementDirective {
    Topic {
        title: String,
        name: Option<String>,
        class: Option<String>,
    },
    SideBar {
        title: Option<String>,
        name: Option<String>,
        class: Option<String>,
    },
    ParsedLiteralBlock {
        inline_nodes: Vec<TreeNodeType>,
        name: Option<String>,
        class: Option<String>,
    },
    Code {
        language: Option<String>,
        name: Option<String>,
        class: Option<String>,
        number_lines: Option<u32>,
    },
    Math {
        name: Option<String>,
        class: Option<String>,
    },
    Rubric {
        name: Option<String>,
        class: Option<String>,
    },
    Epigraph,
    Highlights,
    PullQuote,
    CompoundParagraph {
        name: Option<String>,
        class: Option<String>,
    },
    Container {
        class_names: Option<Vec<String>>,
        name: Option<String>,
    },
}
Expand description

An enumeration of different body element directives.

Variants§

§

Topic

A topic is like a block quote with a title, or a self-contained section with no subsections. Use the “topic” directive to indicate a self-contained idea that is separate from the flow of the document. Topics may occur anywhere a section or transition may occur. Body elements and topics may not contain nested topics.

Details: https://docutils.sourceforge.io/docs/ref/rst/directives.html#topic

Fields

§title: String
§

SideBar

Sidebars are like miniature, parallel documents that occur inside other documents, providing related or reference material. A sidebar is typically offset by a border and “floats” to the side of the page; the document’s main text may flow around it. Sidebars can also be likened to super-footnotes; their content is outside of the flow of the document’s main text.

Details: https://docutils.sourceforge.io/docs/ref/rst/directives.html#sidebar

Fields

§

ParsedLiteralBlock

Unlike an ordinary literal block, the “parsed-literal” directive constructs a literal block where the text is parsed for inline markup. It is equivalent to a line block with different rendering: typically in a typewriter/monospaced typeface, like an ordinary literal block. Parsed literal blocks are useful for adding hyperlinks to code examples.

Details: https://docutils.sourceforge.io/docs/ref/rst/directives.html#parsed-literal-block

Fields

§inline_nodes: Vec<TreeNodeType>
§

Code

The “code” directive constructs a literal block. If the code language is specified, the content is parsed by the Pygments syntax highlighter and tokens are stored in nested inline elements with class arguments according to their syntactic category. The actual highlighting requires a style-sheet (e.g. one generated by Pygments, see the sandbox/stylesheets for examples).

The parsing can be turned off with the syntax_highlight configuration setting and command line option or by specifying the language as :class: option instead of directive argument. This also avoids warnings when Pygments is not installed or the language is not in the supported languages and markup formats.

For inline code, use the “code” role.

Details: https://docutils.sourceforge.io/docs/ref/rst/directives.html#code

Fields

§language: Option<String>
§number_lines: Option<u32>
§

Math

The “math” directive inserts blocks with mathematical content (display formulas, equations) into the document. The input format is subset of LaTeX math syntax with support for Unicode symbols. For inline formulas, use the “math” role.

Details: https://docutils.sourceforge.io/docs/ref/rst/directives.html#math

Fields

§

Rubric

The “rubric” directive inserts a “rubric” element into the document tree. A rubric is like an informal heading that doesn’t correspond to the document’s structure.

Details: https://docutils.sourceforge.io/docs/ref/rst/directives.html#rubric

Fields

§

Epigraph

An epigraph is an apposite (suitable, apt, or pertinent) short inscription, often a quotation or poem, at the beginning of a document or section.

Details: https://docutils.sourceforge.io/docs/ref/rst/directives.html#epigraph

§

Highlights

Highlights summarize the main points of a document or section, often consisting of a list.

The “highlights” directive produces a “highlights”-class block quote. See Epigraph above for an analogous example.

Details: https://docutils.sourceforge.io/docs/ref/rst/directives.html#highlights

§

PullQuote

A pull-quote is a small selection of text “pulled out and quoted”, typically in a larger typeface. Pull-quotes are used to attract attention, especially in long articles.

The “pull-quote” directive produces a “pull-quote”-class block quote. See Epigraph above for an analogous example.

Details https://docutils.sourceforge.io/docs/ref/rst/directives.html#pull-quote

§

CompoundParagraph

The “compound” directive is used to create a compound paragraph, which is a single logical paragraph containing multiple physical body elements such as simple paragraphs,literal blocks, tables, lists, etc., instead of directly containing text and inline elements. For example:

Details: https://docutils.sourceforge.io/docs/ref/rst/directives.html#compound-paragraph

Fields

§

Container

The “container” directive surrounds its contents (arbitrary body elements) with a generic block-level “container” element. Combined with the optional “classes” attribute argument(s), this is an extension mechanism for users & applications. The “container” directive is the equivalent of HTML’s

element. It may be used to group a sequence of elements for user- or application-specific purposes.

Details: https://docutils.sourceforge.io/docs/ref/rst/directives.html#container

Fields

§class_names: Option<Vec<String>>

Trait Implementations§

Source§

impl Debug for BodyElementDirective

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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

Source§

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.