aboutsummaryrefslogtreecommitdiffstats
path: root/src/parser.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-18 16:31:14 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-18 16:31:14 +0200
commit5403261e8213f68633a09fc3e9bc2e6e2cd777b2 (patch)
treebb3a6419ef42f7611c2cb24fe7024228f579331b /src/parser.rs
parent03544cafaa82ba4bd7e0bc3372fc59549a8dc0cc (diff)
downloadmarkdown-rs-5403261e8213f68633a09fc3e9bc2e6e2cd777b2.tar.gz
markdown-rs-5403261e8213f68633a09fc3e9bc2e6e2cd777b2.tar.bz2
markdown-rs-5403261e8213f68633a09fc3e9bc2e6e2cd777b2.zip
Add support for turning off constructs
Diffstat (limited to 'src/parser.rs')
-rw-r--r--src/parser.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/parser.rs b/src/parser.rs
index 725f326..409e812 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -3,6 +3,7 @@
use crate::content::document::document;
use crate::tokenizer::{Code, Event, Point};
use crate::util::codes::parse as parse_codes;
+use crate::{Constructs, Options};
use std::collections::HashSet;
/// Information needed, in all content types, when parsing markdown.
@@ -11,6 +12,7 @@ use std::collections::HashSet;
/// It also references the input value as [`Code`][]s.
#[derive(Debug)]
pub struct ParseState {
+ pub constructs: Constructs,
/// List of codes.
pub codes: Vec<Code>,
/// Set of defined identifiers.
@@ -20,8 +22,9 @@ pub struct ParseState {
/// Turn a string of markdown into events.
///
/// Passes the codes back so the compiler can access the source.
-pub fn parse(value: &str) -> (Vec<Event>, ParseState) {
+pub fn parse(value: &str, options: &Options) -> (Vec<Event>, ParseState) {
let mut parse_state = ParseState {
+ constructs: options.constructs.clone(),
codes: parse_codes(value),
definitions: HashSet::new(),
};