aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-15 10:45:41 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-15 10:45:41 +0200
commita7a4d19fe3bc9e5e0c3218d9af41d9cee80e9374 (patch)
treebd7417c6f79fcfcf2bad8fa55683036968f33f6e
parent8f9c7c6cf112e44f64b3dfbcd012e6550d8883e5 (diff)
downloadmarkdown-rs-a7a4d19fe3bc9e5e0c3218d9af41d9cee80e9374.tar.gz
markdown-rs-a7a4d19fe3bc9e5e0c3218d9af41d9cee80e9374.tar.bz2
markdown-rs-a7a4d19fe3bc9e5e0c3218d9af41d9cee80e9374.zip
Fix lazy first line in code (fenced)
-rw-r--r--src/construct/code_fenced.rs20
-rw-r--r--tests/list.rs1
2 files changed, 7 insertions, 14 deletions
diff --git a/src/construct/code_fenced.rs b/src/construct/code_fenced.rs
index 18beb92..cf3336b 100644
--- a/src/construct/code_fenced.rs
+++ b/src/construct/code_fenced.rs
@@ -377,19 +377,13 @@ fn meta(tokenizer: &mut Tokenizer, code: Code, info: Info) -> StateFnResult {
/// ~~~
/// ```
fn at_break(tokenizer: &mut Tokenizer, code: Code, info: Info) -> StateFnResult {
- let clone = info.clone();
-
- if tokenizer.lazy {
- after(tokenizer, code, info)
- } else {
- tokenizer.check(partial_non_lazy_continuation, |ok| {
- if ok {
- Box::new(move |t, c| at_non_lazy_break(t, c, clone))
- } else {
- Box::new(move |t, c| after(t, c, clone))
- }
- })(tokenizer, code)
- }
+ tokenizer.check(partial_non_lazy_continuation, |ok| {
+ if ok {
+ Box::new(move |t, c| at_non_lazy_break(t, c, info))
+ } else {
+ Box::new(move |t, c| after(t, c, info))
+ }
+ })(tokenizer, code)
}
/// To do.
diff --git a/tests/list.rs b/tests/list.rs
index 2819bdb..0360ee7 100644
--- a/tests/list.rs
+++ b/tests/list.rs
@@ -435,7 +435,6 @@ fn list() {
"should support tight lists w/ a blank line in a block quote"
);
- // To do: list (some crash).
assert_eq!(
micromark("- a\n > b\n ```\n c\n ```\n- d"),
"<ul>\n<li>a\n<blockquote>\n<p>b</p>\n</blockquote>\n<pre><code>c\n</code></pre>\n</li>\n<li>d</li>\n</ul>",