aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-15 19:54:38 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-15 19:54:38 +0200
commit3aa10425c95bbe79050c3166702e38758fbe646e (patch)
treef854f6a2c481f385390e49f7d51ca7172a0b1dff /src/construct
parent2ae00fbbf2f88da9163b512b1f1205e18499ab9e (diff)
downloadmarkdown-rs-3aa10425c95bbe79050c3166702e38758fbe646e.tar.gz
markdown-rs-3aa10425c95bbe79050c3166702e38758fbe646e.tar.bz2
markdown-rs-3aa10425c95bbe79050c3166702e38758fbe646e.zip
Fix interrupting of ordered items
Diffstat (limited to 'src/construct')
-rw-r--r--src/construct/list.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/construct/list.rs b/src/construct/list.rs
index 4eb9797..c2007e6 100644
--- a/src/construct/list.rs
+++ b/src/construct/list.rs
@@ -184,14 +184,16 @@ fn before_unordered(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult {
/// > | 1. a
/// ^
/// ```
-fn inside(tokenizer: &mut Tokenizer, code: Code, mut size: usize) -> StateFnResult {
- size += 1;
+fn inside(tokenizer: &mut Tokenizer, code: Code, size: usize) -> StateFnResult {
match code {
- Code::Char(char) if char.is_ascii_digit() && size < LIST_ITEM_VALUE_SIZE_MAX => {
+ Code::Char(char) if char.is_ascii_digit() && size + 1 < LIST_ITEM_VALUE_SIZE_MAX => {
tokenizer.consume(code);
- (State::Fn(Box::new(move |t, c| inside(t, c, size))), None)
+ (
+ State::Fn(Box::new(move |t, c| inside(t, c, size + 1))),
+ None,
+ )
}
- Code::Char('.' | ')') => {
+ Code::Char('.' | ')') if !tokenizer.interrupt || size < 2 => {
tokenizer.exit(Token::ListItemValue);
marker(tokenizer, code)
}