Skip to main content

DocxOptions

Struct DocxOptions 

Source
pub struct DocxOptions<'a> {
    pub reference: Option<&'a [u8]>,
    pub critic: bool,
    pub track_changes: TrackChanges,
    pub author: String,
    pub date: String,
    pub author_fixed: bool,
    pub date_fixed: bool,
    pub images: Option<&'a dyn Fn(&str) -> Option<Vec<u8>>>,
    pub page: PageSize,
    pub tracking: Option<bool>,
    pub scholar: bool,
}
Expand description

How markdown_to_docx writes a Markdown document to a .docx. Defaults to Word-faithful settings: no reference document, critic = true (CriticMarkup is read as tracked changes), track_changes = All, author "Jubarte", date pinned to 1970-01-01T00:00:00Z (so the same Markdown writes the same bytes), no image loader, US Letter page size.

Fields§

§reference: Option<&'a [u8]>

A .docx whose styles, numbering, page setup, headers and footers the output takes, as pandoc’s --reference-doc; its text is not used. None uses built-in styles on the page DocxOptions::page names.

§critic: bool

Read CriticMarkup as tracked changes and comments. Off, its delimiters are text.

§track_changes: TrackChanges

Keep, accept or reject the tracked changes CriticMarkup describes.

§author: String

Author of the tracked changes and comments.

§date: String

Their date, YYYY-MM-DDTHH:MM:SSZ; fixed by default so the same Markdown writes the same bytes.

§author_fixed: bool

author names the changes and comments that name no one, even when the front matter has an author: (an --author the user typed). false: the front matter’s wins over author.

§date_fixed: bool

date dates the undated changes and comments, even when the front matter has a date (last_modified:, modified:, date:, created:). false: the front matter’s wins over date.

§images: Option<&'a dyn Fn(&str) -> Option<Vec<u8>>>

The bytes of each image the Markdown names. Without it, or when it returns None, an image is written as its alt text.

§page: PageSize

The page size when there is no reference document. With a reference, its page setup wins and a page other than the default is reported in WrittenDocx::warnings.

§tracking: Option<bool>

Word’s Track Changes switch (w:trackRevisions) in the output: Some sets it whatever the Markdown’s track_changes: key says; None follows the key, and without one keeps the reference’s setting (off without a reference).

§scholar: bool

Set the document as LaTeX’s article class sets a manuscript: Latin Modern Roman at 10pt on 12pt lines, justified, bold headings, and the page number centered in the footer from page 2. Only what the front matter leaves out: its own styles: entries, headers and footers win.

Trait Implementations§

Source§

impl<'a> Clone for DocxOptions<'a>

Source§

fn clone(&self) -> DocxOptions<'a>

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 DocxOptions<'_>

Source§

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

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

impl Default for DocxOptions<'_>

Source§

fn default() -> DocxOptions<'_>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for DocxOptions<'a>

§

impl<'a> !Send for DocxOptions<'a>

§

impl<'a> !Sync for DocxOptions<'a>

§

impl<'a> !UnwindSafe for DocxOptions<'a>

§

impl<'a> Forget for DocxOptions<'a>

§

impl<'a> Freeze for DocxOptions<'a>

§

impl<'a> Move for DocxOptions<'a>

§

impl<'a> Unpin for DocxOptions<'a>

§

impl<'a> UnsafeUnpin for DocxOptions<'a>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.