Skip to content

Commit c40262b

Browse files
committed
chore: tweak task list kind
1 parent f5d2442 commit c40262b

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

parser/parser.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,10 @@ func mergeListItemNodes(nodes []ast.Node) []ast.Node {
122122
switch nodes[i].(type) {
123123
case *ast.OrderedListItem:
124124
listKind = ast.OrderedList
125-
case *ast.UnorderedListItem, *ast.TaskListItem:
125+
case *ast.UnorderedListItem:
126126
listKind = ast.UnorderedList
127+
case *ast.TaskListItem:
128+
listKind = ast.DescrpitionList
127129
}
128130
if prevResultNode == nil || prevResultNode.Type() != ast.ListNode || prevResultNode.(*ast.List).Kind != listKind {
129131
prevResultNode = &ast.List{

parser/tests/parser_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func TestParser(t *testing.T) {
174174
},
175175
},
176176
&ast.List{
177-
Kind: ast.UnorderedList,
177+
Kind: ast.DescrpitionList,
178178
Children: []ast.Node{
179179
&ast.TaskListItem{
180180
Symbol: tokenizer.Hyphen,
@@ -193,7 +193,7 @@ func TestParser(t *testing.T) {
193193
text: "- [ ] hello\n- [x] world",
194194
nodes: []ast.Node{
195195
&ast.List{
196-
Kind: ast.UnorderedList,
196+
Kind: ast.DescrpitionList,
197197
Children: []ast.Node{
198198
&ast.TaskListItem{
199199
Symbol: tokenizer.Hyphen,

renderer/html/html_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func TestHTMLRenderer(t *testing.T) {
5353
},
5454
{
5555
text: "- [ ] hello\n- [x] world",
56-
expected: `<ul><li><input type="checkbox" disabled />hello</li><br><li><input type="checkbox" checked disabled />world</li></ul>`,
56+
expected: `<dl><li><input type="checkbox" disabled />hello</li><br><li><input type="checkbox" checked disabled />world</li></dl>`,
5757
},
5858
}
5959

0 commit comments

Comments
 (0)