Skip to main content

FmtOptions

Struct FmtOptions 

Source
pub struct FmtOptions { /* private fields */ }
Expand description

Formatter knobs.

Style knobs default to Preserve except GFM tables, which default to compact normal form. The structural-emit pipeline never consults style knobs; rewrites are applied by the formatter’s rewrite-family pipeline. Structural defaults: wrap = keep, trailing-newline = preserve, end-of-line = lf, empty exclude list.

Implementations§

Source§

impl FmtOptions

Source

pub fn wrap(&self) -> Wrap

Wrap mode for prose paragraphs.

Source

pub fn wrap_strategy(&self) -> WrapStrategy

Paragraph wrap strategy.

Source

pub fn italic(&self) -> ItalicStyle

Italic delimiter normalisation policy.

Source

pub fn strong(&self) -> StrongStyle

Strong-emphasis delimiter normalisation policy.

Source

pub fn list_marker(&self) -> ListMarkerStyle

Unordered-list bullet normalisation policy.

Source

pub fn list_continuation_indent(&self) -> ListContinuationIndent

List continuation indentation used when wrapping list-item paragraphs.

Source

pub fn ordered_list(&self) -> OrderedListStyle

Ordered-list number normalisation policy.

Source

pub fn table(&self) -> TableStyle

GFM table canonicalisation policy.

Source

pub fn trailing_newline(&self) -> TrailingNewline

Trailing-newline policy at the document boundary.

Source

pub fn end_of_line(&self) -> EndOfLine

Line-ending normalisation policy.

Source

pub fn exclude_globs(&self) -> &[String]

Formatter-specific exclude globs (independent of [lint] exclude).

Where reference-link definitions are emitted: gathered + sorted at end of document, or kept in source positions.

Whether reference-link and inline-link destinations are emitted bare or angle-bracketed.

Source

pub fn footnote_placement(&self) -> Placement

Where footnote definitions are emitted. Populated for parity with Self::link_def_placement; session 11 reads this.

Source

pub fn preserve_frontmatter(&self) -> bool

Whether to emit the document’s frontmatter byte-verbatim in the formatted output. true (the default) preserves YAML or TOML frontmatter exactly; false strips it.

Source

pub fn thematic_break_style(&self) -> ThematicStyle

Thematic-break canonicalisation policy. Defaults to ThematicStyle::Preserve. The structural-emit path does not consult this; a later canonicalisation post-pass will.

Source

pub fn math(&self) -> MathOptions

Math canonicalisation configuration. See MathOptions for the reason every field defaults off.

Source

pub fn with_math(self, math: MathOptions) -> Self

Override the math options. Returns the receiver for chaining.

Source

pub fn with_math_render(self, render: MathRender) -> Self

Override only the math render policy. Composes with the existing MathOptions; preserves normalise.

Source

pub fn heading_attrs(&self) -> HeadingAttrsStyle

Heading-attribute trailer emission policy.

Source

pub fn with_heading_attrs(self, style: HeadingAttrsStyle) -> Self

Override the heading-attribute style.

Source

pub fn resolve_italic(&self, source_delim: u8) -> u8

Resolve the italic delimiter to emit, given the byte the source originally used (b'*' or b'_'). Preserve returns source_delim; fixed styles return their own byte. Keeps the match out of every render site.

Source

pub fn with_wrap(self, wrap: Wrap) -> Self

Override the wrap mode. Returns the receiver for chaining. Used by callers that build FmtOptions programmatically (benches, golden tests, --wrap overrides).

Source

pub fn with_wrap_strategy(self, strategy: WrapStrategy) -> Self

Override the paragraph wrap strategy.

Source

pub fn with_italic(self, italic: ItalicStyle) -> Self

Override the italic style. Used by callers that build options programmatically (property tests, CLI overrides).

Source

pub fn with_strong(self, strong: StrongStyle) -> Self

Override the strong style.

Source

pub fn with_list_marker(self, list_marker: ListMarkerStyle) -> Self

Override the unordered-list bullet style.

Source

pub fn with_list_continuation_indent( self, indent: ListContinuationIndent, ) -> Self

Override list continuation indentation for wrapped list items.

Source

pub fn with_ordered_list(self, ordered_list: OrderedListStyle) -> Self

Override the ordered-list numbering policy.

Source

pub fn with_table(self, table: TableStyle) -> Self

Override the GFM table canonicalisation policy.

Source

pub fn with_thematic_break(self, thematic_break: ThematicStyle) -> Self

Override the thematic-break canonicalisation policy.

Override the link-destination style.

Source

pub fn resolve_list_marker(&self, source_marker: u8) -> u8

Resolve the unordered-list bullet to emit, given the byte the source used (b'-', b'*', or b'+').

Source

pub fn with_trailing_newline(self, trailing_newline: TrailingNewline) -> Self

Override the trailing-newline policy.

Source

pub fn with_end_of_line(self, end_of_line: EndOfLine) -> Self

Override the end-of-line policy.

Source

pub fn with_exclude_globs(self, exclude_globs: Vec<String>) -> Self

Override formatter exclude globs.

Override reference-definition placement.

Source

pub fn with_footnote_placement(self, placement: Placement) -> Self

Override footnote-definition placement.

Source

pub fn with_preserve_frontmatter(self, preserve_frontmatter: bool) -> Self

Override frontmatter preservation.

Source§

impl FmtOptions

Source

pub fn mdformat() -> Self

mdformat-compatible formatting profile where mdwright can reproduce mdformat’s spelling without weakening verification.

mdformat 1.0 defaults to wrap = keep; callers that want a column limit should still set Self::with_wrap explicitly.

Trait Implementations§

Source§

impl Clone for FmtOptions

Source§

fn clone(&self) -> FmtOptions

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 FmtOptions

Source§

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

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

impl Default for FmtOptions

Source§

fn default() -> Self

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more