pub struct MarkdownParserConfig { /* private fields */ }Expand description
A configuration for the Markdown parser.
Implementations§
Source§impl MarkdownParserConfig
impl MarkdownParserConfig
Sourcepub fn with_allow_no_space_in_headings(self) -> Self
pub fn with_allow_no_space_in_headings(self) -> Self
Enable the parser to allow headings without a space after the hash marks.
Sourcepub fn with_max_nesting_depth(self, depth: usize) -> Self
pub fn with_max_nesting_depth(self, depth: usize) -> Self
Set the maximum nesting depth of the document.
Every container block (blockquote, list item, footnote definition, GitHub alert)
and every inline element with nested content (emphasis, strikethrough, link label)
adds one level of nesting. When the depth exceeds depth,
parse_markdown returns an error with
nom::error::ErrorKind::TooLarge.
The limit bounds both the parse time and the stack usage on adversarial input
(e.g. thousands of > markers). Defaults to DEFAULT_MAX_NESTING_DEPTH.
Sourcepub fn with_html_entities_map(
self,
html_entities_map: HashMap<String, &'static Entity>,
) -> Self
pub fn with_html_entities_map( self, html_entities_map: HashMap<String, &'static Entity>, ) -> Self
Set a custom map of HTML entities.
Sourcepub fn with_block_blockquote_behavior(
self,
behavior: ElementBehavior<Block>,
) -> Self
pub fn with_block_blockquote_behavior( self, behavior: ElementBehavior<Block>, ) -> Self
Set the behavior of the parser when encountering blockquotes.
Sourcepub fn with_block_github_alert_behavior(
self,
behavior: ElementBehavior<Block>,
) -> Self
pub fn with_block_github_alert_behavior( self, behavior: ElementBehavior<Block>, ) -> Self
Set the behavior of the parser when encountering GitHub alerts.
Sourcepub fn with_block_heading_v1_behavior(
self,
behavior: ElementBehavior<Block>,
) -> Self
pub fn with_block_heading_v1_behavior( self, behavior: ElementBehavior<Block>, ) -> Self
Set the behavior of the parser when encountering headings in style 1 (e.g., # Heading).
Sourcepub fn with_block_heading_v2_behavior(
self,
behavior: ElementBehavior<Block>,
) -> Self
pub fn with_block_heading_v2_behavior( self, behavior: ElementBehavior<Block>, ) -> Self
Set the behavior of the parser when encountering headings in style 2 (e.g., Heading\n===).
Sourcepub fn with_block_thematic_break_behavior(
self,
behavior: ElementBehavior<Block>,
) -> Self
pub fn with_block_thematic_break_behavior( self, behavior: ElementBehavior<Block>, ) -> Self
Set the behavior of the parser when encountering thematic breaks (e.g., ---).
Sourcepub fn with_block_list_behavior(self, behavior: ElementBehavior<Block>) -> Self
pub fn with_block_list_behavior(self, behavior: ElementBehavior<Block>) -> Self
Set the behavior of the parser when encountering lists.
Sourcepub fn with_block_code_block_behavior(
self,
behavior: ElementBehavior<Block>,
) -> Self
pub fn with_block_code_block_behavior( self, behavior: ElementBehavior<Block>, ) -> Self
Set the behavior of the parser when encountering code blocks.
Sourcepub fn with_block_html_block_behavior(
self,
behavior: ElementBehavior<Block>,
) -> Self
pub fn with_block_html_block_behavior( self, behavior: ElementBehavior<Block>, ) -> Self
Set the behavior of the parser when encountering HTML blocks.
Sourcepub fn with_block_footnote_definition_behavior(
self,
behavior: ElementBehavior<Block>,
) -> Self
pub fn with_block_footnote_definition_behavior( self, behavior: ElementBehavior<Block>, ) -> Self
Set the behavior of the parser when encountering footnote definitions.
Sourcepub fn with_block_link_definition_behavior(
self,
behavior: ElementBehavior<Block>,
) -> Self
pub fn with_block_link_definition_behavior( self, behavior: ElementBehavior<Block>, ) -> Self
Set the behavior of the parser when encountering link definitions.
Sourcepub fn with_block_table_behavior(self, behavior: ElementBehavior<Block>) -> Self
pub fn with_block_table_behavior(self, behavior: ElementBehavior<Block>) -> Self
Set the behavior of the parser when encountering tables.
Sourcepub fn with_block_paragraph_behavior(
self,
behavior: ElementBehavior<Block>,
) -> Self
pub fn with_block_paragraph_behavior( self, behavior: ElementBehavior<Block>, ) -> Self
Set the behavior of the parser when encountering block paragraphs.
Sourcepub fn with_inline_autolink_behavior(
self,
behavior: ElementBehavior<Inline>,
) -> Self
pub fn with_inline_autolink_behavior( self, behavior: ElementBehavior<Inline>, ) -> Self
Set the behavior of the parser when encountering inline autolinks.
Sourcepub fn with_inline_link_behavior(
self,
behavior: ElementBehavior<Inline>,
) -> Self
pub fn with_inline_link_behavior( self, behavior: ElementBehavior<Inline>, ) -> Self
Set the behavior of the parser when encountering inline links.
Sourcepub fn with_inline_footnote_reference_behavior(
self,
behavior: ElementBehavior<Inline>,
) -> Self
pub fn with_inline_footnote_reference_behavior( self, behavior: ElementBehavior<Inline>, ) -> Self
Set the behavior of the parser when encountering inline footnote references.
Sourcepub fn with_inline_reference_link_behavior(
self,
behavior: ElementBehavior<Inline>,
) -> Self
pub fn with_inline_reference_link_behavior( self, behavior: ElementBehavior<Inline>, ) -> Self
Set the behavior of the parser when encountering inline reference links.
Sourcepub fn with_inline_hard_newline_behavior(
self,
behavior: ElementBehavior<Inline>,
) -> Self
pub fn with_inline_hard_newline_behavior( self, behavior: ElementBehavior<Inline>, ) -> Self
Set the behavior of the parser when encountering inline hard newlines.
Sourcepub fn with_inline_image_behavior(
self,
behavior: ElementBehavior<Inline>,
) -> Self
pub fn with_inline_image_behavior( self, behavior: ElementBehavior<Inline>, ) -> Self
Set the behavior of the parser when encountering inline images.
Sourcepub fn with_inline_code_span_behavior(
self,
behavior: ElementBehavior<Inline>,
) -> Self
pub fn with_inline_code_span_behavior( self, behavior: ElementBehavior<Inline>, ) -> Self
Set the behavior of the parser when encountering inline code spans.
Sourcepub fn with_inline_emphasis_behavior(
self,
behavior: ElementBehavior<Inline>,
) -> Self
pub fn with_inline_emphasis_behavior( self, behavior: ElementBehavior<Inline>, ) -> Self
Set the behavior of the parser when encountering inline emphasis.
Sourcepub fn with_inline_strikethrough_behavior(
self,
behavior: ElementBehavior<Inline>,
) -> Self
pub fn with_inline_strikethrough_behavior( self, behavior: ElementBehavior<Inline>, ) -> Self
Set the behavior of the parser when encountering inline strikethrough.
Sourcepub fn with_inline_text_behavior(
self,
behavior: ElementBehavior<Inline>,
) -> Self
pub fn with_inline_text_behavior( self, behavior: ElementBehavior<Inline>, ) -> Self
Set the behavior of the parser when encountering inline text.
Trait Implementations§
Source§impl Clone for MarkdownParserConfig
impl Clone for MarkdownParserConfig
Source§fn clone(&self) -> MarkdownParserConfig
fn clone(&self) -> MarkdownParserConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more