Skip to main content

WriterOptions

Struct WriterOptions 

Source
#[non_exhaustive]
pub struct WriterOptions {
Show 18 fields pub extensions: Extensions, pub media: Arc<MediaBag>, pub epub: EpubOptions, 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_datadir: 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.

§media: Arc<MediaBag>

The embedded resources the document references by name but does not carry inline. A writer that re-embeds resource bytes — a notebook re-encoding its image outputs — reads them from here; most writers ignore it. Shared cheaply, so cloning the options does not copy the bytes.

§epub: EpubOptions

Options for the EPUB container writer; ignored by every other writer.

§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
Available on crate feature template only.

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

§template: Option<String>
Available on crate feature template only.

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

§template_dir: Option<PathBuf>
Available on crate feature template only.

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

§template_datadir: Option<PathBuf>
Available on crate feature template only.

A shared directory of partials ($name()$) consulted when a partial is not found beside the including template — the data directory’s templates/. None when no data directory applies.

§template_ext: Option<String>
Available on crate feature template only.

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)>
Available on crate feature template only.

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>
Available on crate feature template only.

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>
Available on crate feature template only.

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

§source_name: Option<String>
Available on crate features container or template only.

The source name a standalone document falls back to 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. Consumed by the HTML family (for its pagetitle) and by the container writer (for the navigation document’s title).

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.