Skip to main content

Constructs

Struct Constructs 

Source
pub struct Constructs {
Show 33 fields pub html_block: bool, pub html_inline: bool, pub indented_code: bool, pub gfm_table: bool, pub gfm_task_list_item: bool, pub gfm_strikethrough: bool, pub gfm_autolink_literal: bool, pub relaxed_autolinks: bool, pub gfm_alert: bool, pub underline: bool, pub insert: bool, pub highlight: bool, pub subscript: bool, pub superscript: bool, pub spoiler: bool, pub shortcode: bool, pub description_list: bool, pub footnote_definition: bool, pub footnote_reference: bool, pub inline_footnote: bool, pub math_block: bool, pub math_inline: bool, pub frontmatter: bool, pub wikilink_title_after_pipe: bool, pub wikilink_title_before_pipe: bool, pub mdx_esm: bool, pub mdx_expression_block: bool, pub mdx_expression_inline: bool, pub mdx_jsx_block: bool, pub mdx_jsx_inline: bool, pub directive_text: bool, pub directive_leaf: bool, pub directive_container: bool,
}
Expand description

The full set of syntactic constructs the parser may recognize, one boolean per feature. This is the exhaustive escape hatch; most callers use the Constructs::commonmark/gfm/mdx/ max presets or the Construct builder instead of setting fields directly.

Fields§

§html_block: bool

Raw HTML blocks, e.g. a <div>…</div> block at the top level.

§html_inline: bool

Raw inline HTML, e.g. <span> within a paragraph.

§indented_code: bool

Indented code blocks (each line indented four spaces or a tab).

§gfm_table: bool

GFM pipe tables: a | a | b | row over a |---|---| delimiter row.

§gfm_task_list_item: bool

GFM task list items: - [ ] (unchecked) and - [x] (checked).

§gfm_strikethrough: bool

GFM strikethrough: ~~text~~.

§gfm_autolink_literal: bool

GFM literal autolinks: a bare https://…, www.…, or email becomes a link without angle brackets.

§relaxed_autolinks: bool

cmark-gfm “relaxed” URL autolinks: bare scheme:// URLs (and a bare leading ://) are auto-linkified without angle brackets, e.g. smb://, irc://, rdar://. This is a cmark extension beyond the GFM spec (which defines only http(s):///www./email); on by default in gfm() for GitHub/cmark-gfm parity. The angle form <scheme:…> works regardless.

§gfm_alert: bool

GFM alerts: a > [!NOTE] (TIP/IMPORTANT/WARNING/CAUTION) blockquote.

§underline: bool

Underline spans: __text__. This overrides CommonMark’s __-as-strong, so it is off in the max default.

§insert: bool

CriticMarkup-style insertions: ++text++.

§highlight: bool

Highlight / “mark” spans: ==text==.

§subscript: bool

Subscript: a single-tilde span ~text~ (no spaces).

§superscript: bool

Superscript: ^text^.

§spoiler: bool

Spoiler spans: ||text||.

§shortcode: bool

Emoji-style shortcodes: :tada:.

§description_list: bool

Description (definition) lists: a term followed by :-led details.

§footnote_definition: bool

Footnote definitions: [^1]: the footnote body.

§footnote_reference: bool

Footnote references: [^1] in running text.

§inline_footnote: bool

Inline footnotes: ^[the note inline] (also needs footnote_reference).

§math_block: bool

Block math: a $$ … $$ fenced block.

§math_inline: bool

Inline math: $x$ (and the math-code form $`x`$).

§frontmatter: bool

A leading frontmatter block at the start of the document: --- YAML or +++ TOML.

§wikilink_title_after_pipe: bool

Wikilinks with the display title after the pipe: [[target|title]] (the Obsidian convention). Mutually exclusive with the before-pipe order.

§wikilink_title_before_pipe: bool

Wikilinks with the display title before the pipe: [[title|target]]. Mutually exclusive with the after-pipe order.

§mdx_esm: bool

MDX ESM: import/export statement lines.

§mdx_expression_block: bool

MDX block-level { … } expressions.

§mdx_expression_inline: bool

MDX inline { … } expressions within text.

§mdx_jsx_block: bool

MDX block-level JSX: <Component/> as a block. Conflicts with raw HTML.

§mdx_jsx_inline: bool

MDX inline JSX: <Component/> within text. Conflicts with raw HTML.

§directive_text: bool

Inline directive: :name[label]{key=val}. A directive, not MDX.

§directive_leaf: bool

Leaf directive: ::name[label]{key=val} on its own line. A directive, not MDX.

§directive_container: bool

Container directive: a :::name … ::: fenced block. A directive, not MDX.

Implementations§

Source§

impl Constructs

Source

pub const fn commonmark() -> Self

The CommonMark baseline: raw HTML and indented code, no extensions.

Source

pub const fn gfm() -> Self

GitHub Flavored Markdown: CommonMark plus tables, task lists, strikethrough, literal autolinks, and footnotes.

Source

pub const fn mdx() -> Self

MDX: CommonMark with raw HTML and indented code off, and MDX ESM, expressions, and JSX on.

Source

pub const fn max() -> Self

The maximal non-MDX construct set, and the default dialect: every construct that does not reinterpret a core CommonMark delimiter. MDX is off (it conflicts with raw HTML and reinterprets {…}/<…>), and underline is off because it would parse __bold__ as underline, overriding CommonMark strong. The wikilink title order is after-pipe.

Trait Implementations§

Source§

impl Clone for Constructs

Source§

fn clone(&self) -> Constructs

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 Constructs

Source§

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

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

impl Default for Constructs

Source§

fn default() -> Self

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

impl Eq for Constructs

Source§

impl PartialEq for Constructs

Source§

fn eq(&self, other: &Constructs) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Constructs

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.