pub struct Constructs {Show 20 fields
pub autolink: bool,
pub code_indented: bool,
pub html_flow: bool,
pub html_text: bool,
pub gfm_autolink_literal: bool,
pub gfm_footnote: bool,
pub gfm_strikethrough: bool,
pub gfm_strikethrough_single_tilde: bool,
pub gfm_table: bool,
pub gfm_task_list_item: bool,
pub math_flow: bool,
pub math_text: bool,
pub liquid: bool,
pub wiki_link: bool,
pub container_directive: bool,
pub mdx_esm: bool,
pub mdx_expression_flow: bool,
pub mdx_expression_text: bool,
pub mdx_jsx_flow: bool,
pub mdx_jsx_text: bool,
}Expand description
Which syntax constructs the parser recognizes.
CommonMark’s core (paragraphs, headings, thematic breaks, blockquotes, lists, fenced code, emphasis, links, hard breaks) is always on. Everything listed here is a construct that some dialect turns off or bolts on.
The default set mirrors Prettier’s parser composition:
GFM + math + wiki-link + liquid,
plus container directives (:::), which Prettier lacks and consequently corrupts.
Fields§
§autolink: bool<https://example.com> / <user@example.com>. Syntax error in MDX.
code_indented: bool4-space indented code blocks. In MDX the indent is an ordinary paragraph (continuation) instead.
html_flow: boolHTML blocks (CommonMark types 1–7).
In MDX < at flow start is JSX.
html_text: boolInline HTML tags/comments.
In MDX < in text is JSX.
gfm_autolink_literal: boolGFM bare-URL links (www.example.com).
Printed verbatim.
gfm_footnote: boolGFM footnotes ([^label]).
gfm_strikethrough: boolGFM strikethrough (~~x~~).
gfm_strikethrough_single_tilde: boolWhether a single ~ also opens strikethrough.
GitHub and Prettier (singleTilde: false) require ~~;
keep this off to leave subscript conventions like H~2~O alone.
gfm_table: boolGFM tables.
gfm_task_list_item: boolGFM task list items (- [x]).
math_flow: bool$$ … $$ display math.
math_text: bool$ … $ inline math, printed verbatim.
liquid: bool{% … %} / {{ … }} template tags, multi-line capable.
Never interpreted, kept lossless.
wiki_link: bool[[target]] wiki links, alias-less minimal form, printed verbatim.
container_directive: bool::: … ::: container directives.
Fence lines are kept verbatim (dialects disagree on their grammar);
only children are markdown.
mdx_esm: boolMDX import / export statements at flow start.
mdx_expression_flow: boolMDX {expr} as its own flow block.
mdx_expression_text: boolMDX {expr} in text.
mdx_jsx_flow: boolMDX JSX elements at flow start.
mdx_jsx_text: boolMDX JSX elements in text.
Implementations§
Source§impl Constructs
impl Constructs
Sourcepub fn markdown() -> Self
pub fn markdown() -> Self
Markdown mode: CommonMark + GFM + Prettier’s extensions + directives.
Sourcepub fn mdx() -> Self
pub fn mdx() -> Self
MDX mode: autolink / code_indented / html_flow / html_text off, the mdx_* family on.
Unlike markdown mode, parsing can emit diagnostics (MDX has syntax errors; CommonMark does not).
TODO: Not usable yet: the mdx_* constructs are unimplemented,
and disabling code_indented must also lift micromark’s 4-space/3-column indent limits engine-wide (currently hardcoded),
so this preset misparses e.g. # hi.
Trait Implementations§
Source§impl Clone for Constructs
impl Clone for Constructs
Source§fn clone(&self) -> Constructs
fn clone(&self) -> Constructs
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more