aboutsummaryrefslogtreecommitdiffstats
path: root/src/parser.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-10-06 15:57:55 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-10-06 15:57:55 +0200
commitcd5bb2d16c6b28332b0b6077b27b2b90a8051896 (patch)
tree848ebc6200b80d2dfdcd67bf0bb245eea06bb24f /src/parser.rs
parent6e80e03bb6d6af47aba2b339f160e4895ab5afba (diff)
downloadmarkdown-rs-cd5bb2d16c6b28332b0b6077b27b2b90a8051896.tar.gz
markdown-rs-cd5bb2d16c6b28332b0b6077b27b2b90a8051896.tar.bz2
markdown-rs-cd5bb2d16c6b28332b0b6077b27b2b90a8051896.zip
Refactor to split parse from compile options
Diffstat (limited to 'src/parser.rs')
-rw-r--r--src/parser.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/parser.rs b/src/parser.rs
index c69eb38..b694bc5 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -4,7 +4,7 @@ use crate::event::{Event, Point};
use crate::state::{Name as StateName, State};
use crate::subtokenize::subtokenize;
use crate::tokenizer::Tokenizer;
-use crate::Options;
+use crate::ParseOptions;
use alloc::{string::String, vec, vec::Vec};
/// Info needed, in all content types, when parsing markdown.
@@ -14,7 +14,7 @@ use alloc::{string::String, vec, vec::Vec};
#[derive(Debug)]
pub struct ParseState<'a> {
/// Configuration.
- pub options: &'a Options,
+ pub options: &'a ParseOptions,
/// List of chars.
pub bytes: &'a [u8],
/// Set of defined definition identifiers.
@@ -26,7 +26,10 @@ pub struct ParseState<'a> {
/// Turn a string of markdown into events.
///
/// Passes the bytes back so the compiler can access the source.
-pub fn parse<'a>(value: &'a str, options: &'a Options) -> Result<(Vec<Event>, &'a [u8]), String> {
+pub fn parse<'a>(
+ value: &'a str,
+ options: &'a ParseOptions,
+) -> Result<(Vec<Event>, &'a [u8]), String> {
let mut parse_state = ParseState {
options,
bytes: value.as_bytes(),