pub struct Constructs {Show 34 fields
pub attention: bool,
pub autolink: bool,
pub block_quote: bool,
pub character_escape: bool,
pub character_reference: bool,
pub code_indented: bool,
pub code_fenced: bool,
pub code_text: bool,
pub definition: bool,
pub frontmatter: bool,
pub gfm_autolink_literal: bool,
pub gfm_footnote_definition: bool,
pub gfm_label_start_footnote: bool,
pub gfm_strikethrough: bool,
pub gfm_table: bool,
pub gfm_task_list_item: bool,
pub hard_break_escape: bool,
pub hard_break_trailing: bool,
pub heading_atx: bool,
pub heading_setext: bool,
pub html_flow: bool,
pub html_text: bool,
pub label_start_image: bool,
pub label_start_link: bool,
pub label_end: bool,
pub list_item: bool,
pub math_flow: bool,
pub math_text: 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,
pub thematic_break: bool,
}Expand description
Control which constructs are enabled.
Not all constructs can be configured. Notably, blank lines and paragraphs cannot be turned off.
§Examples
use markdown::Constructs;
// Use the default trait to get `CommonMark` constructs:
let commonmark = Constructs::default();
// To turn on all of GFM, use the `gfm` method:
let gfm = Constructs::gfm();
// Or, mix and match:
let custom = Constructs {
math_flow: true,
math_text: true,
..Constructs::gfm()
};Fields§
§attention: boolAttention.
> | a *b* c **d**.
^^^ ^^^^^autolink: boolAutolink.
> | a <https://example.com> b <user@example.org>.
^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^block_quote: boolBlock quote.
> | > a
^^^character_escape: boolCharacter escape.
> | a \* b
^^character_reference: boolCharacter reference.
> | a & b
^^^^^code_indented: boolCode (indented).
> | a
^^^^^code_fenced: boolCode (fenced).
> | ~~~js
^^^^^
> | console.log(1)
^^^^^^^^^^^^^^
> | ~~~
^^^code_text: boolCode (text).
> | a `b` c
^^^definition: boolDefinition.
> | [a]: b "c"
^^^^^^^^^^frontmatter: boolFrontmatter.
> | ---
^^^
> | title: Neptune
^^^^^^^^^^^^^^
> | ---
^^^gfm_autolink_literal: boolGFM: autolink literal.
> | https://example.com
^^^^^^^^^^^^^^^^^^^gfm_footnote_definition: boolGFM: footnote definition.
> | [^a]: b
^^^^^^^gfm_label_start_footnote: boolGFM: footnote label start.
> | a[^b]
^^gfm_strikethrough: bool> | a ~b~ c.
^^^gfm_table: boolGFM: table.
> | | a |
^^^^^
> | | - |
^^^^^
> | | b |
^^^^^gfm_task_list_item: boolGFM: task list item.
> | * [x] y.
^^^hard_break_escape: boolHard break (escape).
> | a\
^
| bhard_break_trailing: boolHard break (trailing).
> | a␠␠
^^
| bheading_atx: boolHeading (atx).
> | # a
^^^heading_setext: boolHeading (setext).
> | a
^^
> | ==
^^html_flow: boolHTML (flow).
> | <div>
^^^^^html_text: boolHTML (text).
> | a <b> c
^^^label_start_image: boolLabel start (image).
> | a  d
^^label_start_link: boolLabel start (link).
> | a [b](c) d
^label_end: boolLabel end.
> | a [b](c) d
^^^^list_item: boolList items.
> | * a
^^^math_flow: boolMath (flow).
> | $$
^^
> | \frac{1}{2}
^^^^^^^^^^^
> | $$
^^math_text: boolMath (text).
> | a $b$ c
^^^mdx_esm: boolMDX: ESM.
> | import a from 'b'
^^^^^^^^^^^^^^^^^👉 Note: to support ESM, you must pass
mdx_esm_parseinParseOptionstoo. Otherwise, ESM is treated as normal markdown.
mdx_expression_flow: boolMDX: expression (flow).
> | {Math.PI}
^^^^^^^^^👉 Note: You can pass
mdx_expression_parseinParseOptionstoo, to parse expressions according to a certain grammar (typically, a programming language). Otherwise, expressions are parsed with a basic algorithm that only cares about braces.
mdx_expression_text: boolMDX: expression (text).
> | a {Math.PI} c
^^^^^^^^^👉 Note: You can pass
mdx_expression_parseinParseOptionstoo, to parse expressions according to a certain grammar (typically, a programming language). Otherwise, expressions are parsed with a basic algorithm that only cares about braces.
mdx_jsx_flow: boolMDX: JSX (flow).
> | <Component />
^^^^^^^^^^^^^👉 Note: You must pass
html_flow: falseto use this, as it’s preferred when on overmdx_jsx_flow.
👉 Note: You can pass
mdx_expression_parseinParseOptionstoo, to parse expressions in JSX according to a certain grammar (typically, a programming language). Otherwise, expressions are parsed with a basic algorithm that only cares about braces.
mdx_jsx_text: boolMDX: JSX (text).
> | a <Component /> c
^^^^^^^^^^^^^👉 Note: You must pass
html_text: falseto use this, as it’s preferred when on overmdx_jsx_text.
👉 Note: You can pass
mdx_expression_parseinParseOptionstoo, to parse expressions in JSX according to a certain grammar (typically, a programming language). Otherwise, expressions are parsed with a basic algorithm that only cares about braces.
thematic_break: boolThematic break.
> | ***
^^^Implementations§
Source§impl Constructs
impl Constructs
Sourcepub fn gfm() -> Self
pub fn gfm() -> Self
GFM.
GFM stands for GitHub flavored markdown.
GFM extends CommonMark and adds support for autolink literals,
footnotes, strikethrough, tables, and tasklists.
For more information, see the GFM specification: https://github.github.com/gfm/.
Sourcepub fn mdx() -> Self
pub fn mdx() -> Self
MDX.
This turns on CommonMark, turns off some conflicting constructs
(autolinks, code (indented), and HTML), and turns on MDX (ESM,
expressions, and JSX).
For more information, see the MDX website: https://mdxjs.com.
👉 Note: to support ESM, you must pass
mdx_esm_parseinParseOptionstoo. Otherwise, ESM is treated as normal markdown.You can pass
mdx_expression_parseto parse expressions according to a certain grammar (typically, a programming language). Otherwise, expressions are parsed with a basic algorithm that only cares about braces.
Trait Implementations§
Source§impl Clone for Constructs
impl Clone for Constructs
Source§fn clone(&self) -> Constructs
fn clone(&self) -> Constructs
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Constructs
impl Debug for Constructs
Source§impl Default for Constructs
impl Default for Constructs
Source§fn default() -> Self
fn default() -> Self
CommonMark.
CommonMark is a relatively strong specification of how markdown
works.
Most markdown parsers try to follow it.
For more information, see the CommonMark specification:
https://spec.commonmark.org.