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: boolWhen 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: boolWhen 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
impl Clone for ParseConfig
Source§fn clone(&self) -> ParseConfig
fn clone(&self) -> ParseConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more