diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-09-12 17:43:19 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-09-12 17:49:13 +0200 |
commit | 65d4b46c2a3bdecb0493e484473d2de3d124f839 (patch) | |
tree | 3f2b03a9bdabdddd81242556b13dbfa07739b9a0 | |
parent | 57c3cda9f98e70a9f614a22eb6d518051cc60b19 (diff) | |
download | markdown-rs-65d4b46c2a3bdecb0493e484473d2de3d124f839.tar.gz markdown-rs-65d4b46c2a3bdecb0493e484473d2de3d124f839.tar.bz2 markdown-rs-65d4b46c2a3bdecb0493e484473d2de3d124f839.zip |
Fix containers piercing into indented code
Diffstat (limited to '')
-rw-r--r-- | src/construct/code_indented.rs | 2 | ||||
-rw-r--r-- | src/tokenizer.rs | 2 | ||||
-rw-r--r-- | tests/fuzz.rs | 16 |
3 files changed, 16 insertions, 4 deletions
diff --git a/src/construct/code_indented.rs b/src/construct/code_indented.rs index f2644d4..ec55aa6 100644 --- a/src/construct/code_indented.rs +++ b/src/construct/code_indented.rs @@ -146,7 +146,7 @@ pub fn after(tokenizer: &mut Tokenizer) -> State { /// | bbb /// ``` pub fn further_start(tokenizer: &mut Tokenizer) -> State { - if tokenizer.lazy { + if tokenizer.lazy || tokenizer.pierce { return State::Nok; } diff --git a/src/tokenizer.rs b/src/tokenizer.rs index aca8ec2..5095abb 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -372,7 +372,7 @@ impl<'a> Tokenizer<'a> { }, map: EditMap::new(), interrupt: false, - pierce: true, + pierce: false, concrete: false, lazy: false, resolvers: vec![], diff --git a/tests/fuzz.rs b/tests/fuzz.rs index 126032a..146ff24 100644 --- a/tests/fuzz.rs +++ b/tests/fuzz.rs @@ -10,9 +10,9 @@ fn fuzz() -> Result<(), String> { "1: label, blank lines, and code" ); + // The first link is stopped by the `+` (so it’s `a@b.c`), but the next + // link overlaps it (`b.c+d@e.f`). assert_eq!( - // The first link is stopped by the `+` (so it’s `a@b.c`), but the next - // link overlaps it (`b.c+d@e.f`). micromark_with_options( "a@b.c+d@e.f", &Options { @@ -25,5 +25,17 @@ fn fuzz() -> Result<(), String> { "2: gfm: email autolink literals running into each other" ); + assert_eq!( + micromark(" x\n* "), + "<pre><code>x\n</code></pre>\n<ul>\n<li></li>\n</ul>", + "3-a: containers should not pierce into indented code" + ); + + assert_eq!( + micromark(" a\n* b"), + "<pre><code>a\n</code></pre>\n<ul>\n<li>\n<pre><code>b\n</code></pre>\n</li>\n</ul>", + "3-b: containers should not pierce into indented code" + ); + Ok(()) } |