pub struct Options<'c> {
pub comrak: Options<'c>,
pub aozora_enabled: bool,
pub source_line_anchors: bool,
}Expand description
Parse-time configuration for render_to_string and friends.
Fields§
§comrak: Options<'c>§aozora_enabled: boolWhen true, run the aozora lex pre-pass and HTML
post-processing. When false, the input flows straight into
vanilla comrak::parse_document + format_html — used by the
CommonMark / GFM spec conformance runners to verify the wrapper
does not perturb upstream behaviour.
source_line_anchors: boolWhen true, the HTML renderer adds data-afm-source-line="N"
(1-based) to every top-level block element it emits. The
afm-obsidian document-mode adapter (Pillar 6 of the plan)
uses these anchors to map per-block post-processor calls back
to slices of the rendered fragment without re-parsing.
Defaults to false. Cost when enabled: one extra walk over
comrak’s top-level AST children + a streaming insert pass on
the produced HTML. Both are O(blocks).
Implementations§
Source§impl Options<'_>
impl Options<'_>
Sourcepub fn afm_default() -> Self
pub fn afm_default() -> Self
Default afm configuration: GFM extensions on (strikethrough,
table, autolink, tasklist), hardbreaks on so each Aozora source
newline becomes a <br> (verse / dialogue boundaries are
load-bearing in 青空文庫 source).
Sourcepub fn commonmark_only() -> Self
pub fn commonmark_only() -> Self
Plain CommonMark (no GFM, no Aozora, raw HTML enabled). Used by the CommonMark 0.31.2 spec-conformance test to verify the wrapper does not perturb comrak’s CommonMark behaviour.
Sourcepub fn gfm_only() -> Self
pub fn gfm_only() -> Self
Pure-GFM extension set (no Aozora, raw HTML enabled). Used by the GFM 0.29 spec-conformance test.
Sourcepub fn with_source_line_anchors(self, on: bool) -> Self
pub fn with_source_line_anchors(self, on: bool) -> Self
Builder-style toggle for source-line anchors. Returns a new
Options with source_line_anchors = on.
use afm_markdown::Options;
let opts = Options::afm_default().with_source_line_anchors(true);
assert!(opts.source_line_anchors);Trait Implementations§
Auto Trait Implementations§
impl<'c> Freeze for Options<'c>
impl<'c> RefUnwindSafe for Options<'c>
impl<'c> Send for Options<'c>
impl<'c> Sync for Options<'c>
impl<'c> Unpin for Options<'c>
impl<'c> UnsafeUnpin for Options<'c>
impl<'c> UnwindSafe for Options<'c>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more