pub struct PrettyCodeOptions {Show 14 fields
pub theme: PrettyCodeTheme,
pub default_mode: Option<String>,
pub multi_theme_strategy: Option<MultiThemeStrategy>,
pub keep_raw_string: Option<bool>,
pub fragment_wrapper: Option<bool>,
pub line_class: Option<String>,
pub highlighted_line_attr: Option<String>,
pub default_language: Option<String>,
pub fallback_to_plaintext: Option<bool>,
pub render_title: Option<bool>,
pub include_data_language: Option<bool>,
pub include_pre_background: Option<bool>,
pub skip_languages: Vec<String>,
pub tab_size: Option<u32>,
}Expand description
Top-level pretty-code configuration. Stored on CompileConfig as
Option<PrettyCodeOptions>; None means “use built-in defaults”.
Every field below has a sensible default; callers only set the knobs
they care about. Field names match the TS-side PrettyCodeOptions
shape exported from @gentleduck/md.
Fields§
§theme: PrettyCodeThemeTheme spec. String for single-theme, object for multi-mode.
default_mode: Option<String>Mode key whose colors fill the unprefixed color /
background-color attrs. Only meaningful for PrettyCodeTheme::Multi.
When unset, resolves to "dark" if present, else the first key.
multi_theme_strategy: Option<MultiThemeStrategy>Multi-theme DOM strategy. Default CssVars (single tree, faster).
Set to Split for one <pre data-theme="..."> subtree per theme
(velite parity, ~2x the AST nodes). Single-theme mode ignores this
- there’s only one tree either way.
keep_raw_string: Option<bool>Keep the __dmcRaw__ attribute on each <pre> so consumer
<PreBlock> can offer a Copy button without re-parsing the tree.
Default true.
fragment_wrapper: Option<bool>Wrap the per-theme <pre> blocks in a
<div data-dmc-fragment=""> envelope. Default
true. Set false to emit just the <pre> siblings (compatible
with consumers that wrap themselves).
line_class: Option<String>Class on each line <span>. Default "line".
highlighted_line_attr: Option<String>Attribute name set on highlighted lines (from {1,3-5} meta).
Default "data-dmc-line-highlighted".
default_language: Option<String>Language used when a fence has no lang and for unknown langs
when Self::fallback_to_plaintext is on. Default "plaintext".
fallback_to_plaintext: Option<bool>When true (default), unknown fence languages render as plain
text. When false, the code block is left as a CodeBlock node
for downstream tooling.
render_title: Option<bool>Render a <figcaption data-dmc-title> from the
fence’s title="..." meta. Default true.
include_data_language: Option<bool>Include data-language on every emitted <pre> and <code>.
Default true.
include_pre_background: Option<bool>Emit a solid background-color on <pre> from the primary theme.
Default true. Set to false to skip the inline bg so the outer
[data-dmc-fragment] wrapper (or consumer chrome) owns the
surface color. Per-mode --dmc-{mode}-bg custom properties are
always emitted regardless of this flag, so consumer CSS can still
opt back in via var(--dmc-{mode}-bg) if it wants.
skip_languages: Vec<String>Languages to skip - these blocks are passed through unchanged.
mermaid is always skipped (owned by the mermaid transformer);
add other langs to keep them as raw CodeBlock nodes.
tab_size: Option<u32>Expand tab characters to N spaces before highlighting. None
preserves original tabs.
Trait Implementations§
Source§impl Clone for PrettyCodeOptions
impl Clone for PrettyCodeOptions
Source§fn clone(&self) -> PrettyCodeOptions
fn clone(&self) -> PrettyCodeOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PrettyCodeOptions
impl Debug for PrettyCodeOptions
Source§impl Default for PrettyCodeOptions
impl Default for PrettyCodeOptions
Source§fn default() -> PrettyCodeOptions
fn default() -> PrettyCodeOptions
Source§impl<'de> Deserialize<'de> for PrettyCodeOptionswhere
PrettyCodeOptions: Default,
impl<'de> Deserialize<'de> for PrettyCodeOptionswhere
PrettyCodeOptions: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for PrettyCodeOptions
impl RefUnwindSafe for PrettyCodeOptions
impl Send for PrettyCodeOptions
impl Sync for PrettyCodeOptions
impl Unpin for PrettyCodeOptions
impl UnsafeUnpin for PrettyCodeOptions
impl UnwindSafe for PrettyCodeOptions
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,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more