pub struct SyntaxOptions {
pub constructs: Constructs,
pub parse: ParseOptions,
}Expand description
A full syntax configuration: which Constructs are recognized plus the
ParseOptions lexing knobs. Build one with a preset
(commonmark/gfm/
mdx/default), optionally
tune it with enable/disable,
then call parse.
Fields§
§constructs: ConstructsWhich syntactic constructs are recognized.
parse: ParseOptionsLexing / source-preservation knobs.
Implementations§
Source§impl SyntaxOptions
impl SyntaxOptions
Sourcepub fn commonmark() -> Self
pub fn commonmark() -> Self
The strict CommonMark dialect.
Sourcepub fn enable(self, construct: Construct) -> Self
pub fn enable(self, construct: Construct) -> Self
Enable a Construct on top of these options, returning the modified
options for chaining. Grouped constructs (footnotes, math, directives, …)
flip every flag in the group so no member is left silently inert.
Sourcepub fn disable(self, construct: Construct) -> Self
pub fn disable(self, construct: Construct) -> Self
Disable a Construct, the inverse of SyntaxOptions::enable.
Sourcepub fn validate(&self) -> Result<(), SyntaxConfigError>
pub fn validate(&self) -> Result<(), SyntaxConfigError>
Check for contradictory construct combinations (MDX JSX with raw HTML;
both wikilink title orders). Returns Ok(()) for every preset; only a
hand-built config can trip a SyntaxConfigError.
Source§impl SyntaxOptions
impl SyntaxOptions
Sourcepub fn parse(&self, input: &str) -> ParseOutput
pub fn parse(&self, input: &str) -> ParseOutput
Parse input under these options. Infallible and tolerant: a config
conflict (reachable only by hand-building contradictory Constructs) is
surfaced as an error diagnostic rather than a hard error. Call
SyntaxOptions::validate first for fail-fast config checking.
Sourcepub fn parse_strict(&self, input: &str) -> Result<ParseOutput, ParseStrictError>
pub fn parse_strict(&self, input: &str) -> Result<ParseOutput, ParseStrictError>
Parse input, promoting a config conflict or any error-severity
diagnostic to a hard ParseStrictError.
Trait Implementations§
Source§impl Clone for SyntaxOptions
impl Clone for SyntaxOptions
Source§fn clone(&self) -> SyntaxOptions
fn clone(&self) -> SyntaxOptions
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 SyntaxOptions
impl Debug for SyntaxOptions
Source§impl Default for SyntaxOptions
impl Default for SyntaxOptions
impl Eq for SyntaxOptions
Source§impl PartialEq for SyntaxOptions
impl PartialEq for SyntaxOptions
Source§fn eq(&self, other: &SyntaxOptions) -> bool
fn eq(&self, other: &SyntaxOptions) -> bool
self and other values to be equal, and is used by ==.