diff options
-rw-r--r-- | src/compiler.rs | 2 | ||||
-rw-r--r-- | src/construct/list.rs | 7 | ||||
-rw-r--r-- | tests/block_quote.rs | 11 | ||||
-rw-r--r-- | tests/list.rs | 21 |
4 files changed, 22 insertions, 19 deletions
diff --git a/src/compiler.rs b/src/compiler.rs index 51c7e2b..fc0f986 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -1239,7 +1239,7 @@ fn on_enter_list(context: &mut CompileContext) { false }; - if !at_marker && (!at_list_item || !at_empty_list_item) { + if !at_marker && !at_list_item && !at_empty_list_item { loose = true; break; } diff --git a/src/construct/list.rs b/src/construct/list.rs index 6614122..2fe46b0 100644 --- a/src/construct/list.rs +++ b/src/construct/list.rs @@ -345,7 +345,12 @@ pub fn resolve(tokenizer: &mut Tokenizer) -> Vec<Event> { && skip::opt( &tokenizer.events, previous.3 + 1, - &[Token::SpaceOrTab, Token::LineEnding, Token::BlankLineEnding], + &[ + Token::SpaceOrTab, + Token::LineEnding, + Token::BlankLineEnding, + Token::BlockQuotePrefix, + ], ) == current.2 { println!("prev:match {:?} {:?}", previous, current); diff --git a/tests/block_quote.rs b/tests/block_quote.rs index c60085d..06bd49a 100644 --- a/tests/block_quote.rs +++ b/tests/block_quote.rs @@ -51,12 +51,11 @@ fn block_quote() { "should not support lazy setext headings underlines in block quotes" ); - // To do: list (something with interrupting? 🤷♂️). - // assert_eq!( - // micromark("> - a\n> - b"), - // "<blockquote>\n<ul>\n<li>a</li>\n<li>b</li>\n</ul>\n</blockquote>", - // "should support lists in block quotes" - // ); + assert_eq!( + micromark("> - a\n> - b"), + "<blockquote>\n<ul>\n<li>a</li>\n<li>b</li>\n</ul>\n</blockquote>", + "should support lists in block quotes" + ); assert_eq!( micromark("> - a\n- b"), diff --git a/tests/list.rs b/tests/list.rs index e773a84..2819bdb 100644 --- a/tests/list.rs +++ b/tests/list.rs @@ -429,19 +429,18 @@ fn list() { "should support tight lists w/ a blank line in a sublist" ); - // To do: list (loose/tight bug). - // assert_eq!( - // micromark("* a\n > b\n >\n* c"), - // "<ul>\n<li>a\n<blockquote>\n<p>b</p>\n</blockquote>\n</li>\n<li>c</li>\n</ul>", - // "should support tight lists w/ a blank line in a block quote" - // ); + assert_eq!( + micromark("* a\n > b\n >\n* c"), + "<ul>\n<li>a\n<blockquote>\n<p>b</p>\n</blockquote>\n</li>\n<li>c</li>\n</ul>", + "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>", - // "should support tight lists w/ flow w/o blank line" - // ); + 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>", + "should support tight lists w/ flow w/o blank line" + ); assert_eq!( micromark("- a"), |