aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/blank_line.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-20 17:06:00 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-20 17:06:00 +0200
commit65dd765cceee8bdccc74c08066eec59a579a16b1 (patch)
treecb60ab00039135b6f0a65efcb508f73a8b39aa11 /src/construct/blank_line.rs
parent61271d73128f8553f8c4c17927828cde52a25eba (diff)
downloadmarkdown-rs-65dd765cceee8bdccc74c08066eec59a579a16b1.tar.gz
markdown-rs-65dd765cceee8bdccc74c08066eec59a579a16b1.tar.bz2
markdown-rs-65dd765cceee8bdccc74c08066eec59a579a16b1.zip
Add improved whitespace handling
* add several helpers for parsing betwen x and y `space_or_tab`s * use those helpers in a bunch of places * move initial indent parsing to flow constructs themselves
Diffstat (limited to '')
-rw-r--r--src/construct/blank_line.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/construct/blank_line.rs b/src/construct/blank_line.rs
index fdb1ee0..86091d9 100644
--- a/src/construct/blank_line.rs
+++ b/src/construct/blank_line.rs
@@ -29,27 +29,24 @@
//!
//! <!-- To do: link `list` -->
-use crate::construct::partial_whitespace::start as whitespace;
-use crate::tokenizer::{Code, State, StateFnResult, TokenType, Tokenizer};
+use crate::construct::partial_space_or_tab::space_or_tab_opt;
+use crate::tokenizer::{Code, State, StateFnResult, Tokenizer};
/// Start of a blank line.
///
-/// Note: `␠` represents a space character.
+/// > 👉 **Note**: `␠` represents a space character.
///
/// ```markdown
/// |␠␠
/// |
/// ```
pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult {
- tokenizer.attempt(
- |tokenizer, code| whitespace(tokenizer, code, TokenType::BlankLineWhitespace),
- |_ok| Box::new(after),
- )(tokenizer, code)
+ tokenizer.go(space_or_tab_opt(), after)(tokenizer, code)
}
/// After zero or more spaces or tabs, before a line ending or EOF.
///
-/// Note: `␠` represents a space character.
+/// > 👉 **Note**: `␠` represents a space character.
///
/// ```markdown
/// |␠␠