From fa88006eeeb1a3670c53f782193f5817e515301b Mon Sep 17 00:00:00 2001
From: yuin
Date: Sat, 12 Oct 2024 19:17:05 +0900
Subject: [PATCH] Fix #466
---
_test/extra.txt | 15 +++++++++++++++
parser/list_item.go | 2 +-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/_test/extra.txt b/_test/extra.txt
index 408b968..85564b1 100644
--- a/_test/extra.txt
+++ b/_test/extra.txt
@@ -794,3 +794,18 @@ text" />
//- - - - - - - - -//
[a]
//= = = = = = = = = = = = = = = = = = = = = = = =//
+
+64: Nested list under an empty list item
+//- - - - - - - - -//
+-
+ - foo
+//- - - - - - - - -//
+
+//= = = = = = = = = = = = = = = = = = = = = = = =//
+
diff --git a/parser/list_item.go b/parser/list_item.go
index 81357a9..2206ad9 100644
--- a/parser/list_item.go
+++ b/parser/list_item.go
@@ -58,7 +58,7 @@ func (b *listItemParser) Continue(node ast.Node, reader text.Reader, pc Context)
}
offset := lastOffset(node.Parent())
- isEmpty := node.ChildCount() == 0
+ isEmpty := node.ChildCount() == 0 && pc.Get(emptyListItemWithBlankLines) != nil
indent, _ := util.IndentWidth(line, reader.LineOffset())
if (isEmpty || indent < offset) && indent < 4 {
_, typ := matchesListItem(line, true)