From 19c1f1bf290e3ac482f0d580f28cd0d1fb24b929 Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Mon, 5 Dec 2022 23:45:36 -0600 Subject: [PATCH] fix: fix loose item with line break at beginning --- src/Tokenizer.js | 2 +- test/specs/new/list_loose.html | 9 +++++++++ test/specs/new/list_loose.md | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 test/specs/new/list_loose.html create mode 100644 test/specs/new/list_loose.md diff --git a/src/Tokenizer.js b/src/Tokenizer.js index e786450fa97..ad7ac4010b7 100644 --- a/src/Tokenizer.js +++ b/src/Tokenizer.js @@ -319,7 +319,7 @@ export class Tokenizer { if (!list.loose) { // Check if list should be loose const spacers = list.items[i].tokens.filter(t => t.type === 'space'); - const hasMultipleLineBreaks = spacers.length > 0 && spacers.every(t => /\n.*\n/.test(t.raw)); + const hasMultipleLineBreaks = spacers.length > 0 && spacers.some(t => /\n.*\n/.test(t.raw)); list.loose = hasMultipleLineBreaks; } diff --git a/test/specs/new/list_loose.html b/test/specs/new/list_loose.html new file mode 100644 index 00000000000..2d004dec265 --- /dev/null +++ b/test/specs/new/list_loose.html @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/test/specs/new/list_loose.md b/test/specs/new/list_loose.md new file mode 100644 index 00000000000..dc69f434e7c --- /dev/null +++ b/test/specs/new/list_loose.md @@ -0,0 +1,5 @@ +- item 1 +- + item 2 + + still item 2