diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-06-22 14:43:42 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-06-22 14:43:42 +0200 |
commit | 33b69eb9189fb2fd0f731530285baf3ac20c5eb0 (patch) | |
tree | fb4ad9ad645192b67f01b4727136d0a298b71909 /src/content/flow.rs | |
parent | 0fcfeaf05a95ea17763a72d91b6aa1c01843d067 (diff) | |
download | markdown-rs-33b69eb9189fb2fd0f731530285baf3ac20c5eb0.tar.gz markdown-rs-33b69eb9189fb2fd0f731530285baf3ac20c5eb0.tar.bz2 markdown-rs-33b69eb9189fb2fd0f731530285baf3ac20c5eb0.zip |
Refactor to improve tokenizer, add docs
Diffstat (limited to 'src/content/flow.rs')
-rw-r--r-- | src/content/flow.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/content/flow.rs b/src/content/flow.rs index 481c8ff..6283fef 100644 --- a/src/content/flow.rs +++ b/src/content/flow.rs @@ -94,14 +94,16 @@ fn blank_line_after(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { fn initial_before(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { match code { Code::None => (State::Ok, None), - _ => tokenizer.attempt_7( - code_indented, - code_fenced, - html_flow, - heading_atx, - thematic_break, - definition, - heading_setext, + _ => tokenizer.attempt_n( + vec![ + Box::new(code_indented), + Box::new(code_fenced), + Box::new(html_flow), + Box::new(heading_atx), + Box::new(thematic_break), + Box::new(definition), + Box::new(heading_setext), + ], |ok| Box::new(if ok { after } else { before_paragraph }), )(tokenizer, code), } |