Skip to main content

WriterOptions

Struct WriterOptions 

Source
#[non_exhaustive]
pub struct WriterOptions {
Show 15 fields pub extensions: Extensions, pub wrap: WrapMode, pub columns: Option<usize>, pub number_sections: bool, pub toc: bool, pub toc_depth: Option<usize>, pub math_method: MathMethod, pub standalone: bool, pub template: Option<String>, pub template_dir: Option<PathBuf>, pub template_ext: Option<String>, pub variables: Vec<(String, String)>, pub metadata: BTreeMap<String, MetaValue>, pub metadata_defaults: BTreeMap<String, MetaValue>, pub source_name: Option<String>,
}
Expand description

Options controlling a Writer. Extended (not resignatured) as real options land.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§extensions: Extensions

Format extensions to enable.

§wrap: WrapMode

How paragraphs are laid out: reflowed to the fill column, never wrapped, or with the source’s own line breaks preserved.

§columns: Option<usize>

The fill column a wrapping writer reflows to under WrapMode::Auto. None uses the writer’s built-in default width.

§number_sections: bool

Splice a hierarchical section number into each heading. A format that numbers headings with a typesetting counter applies it through its template instead (see Writer::numbers_sections_natively).

§toc: bool

Emit a table of contents in a standalone document.

§toc_depth: Option<usize>

The deepest heading level the table of contents includes. None uses the conventional depth of three.

§math_method: MathMethod

How math is presented by a format offering a choice of renderers (the HTML family).

§standalone: bool

Emit a complete document by wrapping the rendered body in the target format’s template, rather than a bare fragment.

§template: Option<String>

Template source overriding the format’s built-in default. Its presence implies standalone output.

§template_dir: Option<PathBuf>

Directory used to resolve template partials ($name()$).

§template_ext: Option<String>

Extension a partial ($name()$) inherits from the including template: the --template file’s own extension, so the same partial name resolves to the same kind of file whatever the output format. An empty string means the template file had no extension (the partial is looked up bare). Absent for a built-in default, where the format name is used instead.

§variables: Vec<(String, String)>

Raw template variables, in order; a repeated key accumulates into a list. Inserted verbatim (unescaped) at the highest precedence when building the template context.

§metadata: BTreeMap<String, MetaValue>

Metadata layered above the document’s own (the -M layer): each key replaces the reader’s value for that key when the context is built.

§metadata_defaults: BTreeMap<String, MetaValue>

Metadata layered below the document’s own (the metadata-file layer): supplies defaults the reader’s values and -M override.

§source_name: Option<String>

The source name an HTML-family standalone document falls back to for its pagetitle when no title metadata is present: an input file’s stem, or - for standard input. None outside the command line, where there is no source name and the fallback is empty.

Trait Implementations§

Source§

impl Clone for WriterOptions

Source§

fn clone(&self) -> WriterOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WriterOptions

Source§

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

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

impl Default for WriterOptions

Source§

fn default() -> WriterOptions

Returns the “default value” for a type. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.