Skip to main content

ParseConfig

Struct ParseConfig 

Source
pub struct ParseConfig {
    pub emit_source_lines: bool,
    pub implicit_figure: bool,
}
Expand description

Parser configuration flags.

Threaded through parse_with_config to gate optional parser behaviors that the renderer needs to coordinate with (source-line tracking for preview scroll sync, implicit-figure promotion).

Default = “production preview off” — emit_source_lines: false, implicit_figure: true. The implicit_figure default mirrors today’s always-on behavior of the parser before this config existed; flipping it off is opt-in for the small set of fragment-render call sites that need bare <img> (none today, but the flag exists for symmetry with the legacy transform_events API and the production site_config field).

Fields§

§emit_source_lines: bool

When true, populates BlockMeta::source_line for top-level blocks. The renderer emits data-source-line="N" on the opening tag for any block whose meta carries Some(N).

Production wires this from process_markdown_file’s emit_source_lines argument (true during preview builds, false during ship-stage publish builds — data-source-line is stripped at ship time anyway, but emitting fewer attrs upstream is cheaper and keeps published HTML clean from earlier stages).

§implicit_figure: bool

When true (default), image-only paragraphs promote to Block::Figure via [try_promote_to_figure]. When false, they stay as Block::Paragraph containing one Inline::Image.

Production wires this from site_config.implicit_figure (default true). The flag mirrors the legacy transform_events implicit-figure pass: sites that prefer bare <img> (no <figure> wrap) can opt out.

Trait Implementations§

Source§

impl Clone for ParseConfig

Source§

fn clone(&self) -> ParseConfig

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 ParseConfig

Source§

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

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

impl Default for ParseConfig

Source§

fn default() -> Self

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

impl Copy for ParseConfig

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.