Skip to content

Commit

Permalink
chore: tweak task list kind
Browse files Browse the repository at this point in the history
  • Loading branch information
boojack committed Sep 19, 2024
1 parent f5d2442 commit c40262b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ func mergeListItemNodes(nodes []ast.Node) []ast.Node {
switch nodes[i].(type) {
case *ast.OrderedListItem:
listKind = ast.OrderedList
case *ast.UnorderedListItem, *ast.TaskListItem:
case *ast.UnorderedListItem:
listKind = ast.UnorderedList
case *ast.TaskListItem:
listKind = ast.DescrpitionList
}
if prevResultNode == nil || prevResultNode.Type() != ast.ListNode || prevResultNode.(*ast.List).Kind != listKind {
prevResultNode = &ast.List{
Expand Down
4 changes: 2 additions & 2 deletions parser/tests/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func TestParser(t *testing.T) {
},
},
&ast.List{
Kind: ast.UnorderedList,
Kind: ast.DescrpitionList,
Children: []ast.Node{
&ast.TaskListItem{
Symbol: tokenizer.Hyphen,
Expand All @@ -193,7 +193,7 @@ func TestParser(t *testing.T) {
text: "- [ ] hello\n- [x] world",
nodes: []ast.Node{
&ast.List{
Kind: ast.UnorderedList,
Kind: ast.DescrpitionList,
Children: []ast.Node{
&ast.TaskListItem{
Symbol: tokenizer.Hyphen,
Expand Down
2 changes: 1 addition & 1 deletion renderer/html/html_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestHTMLRenderer(t *testing.T) {
},
{
text: "- [ ] hello\n- [x] world",
expected: `<ul><li><input type="checkbox" disabled />hello</li><br><li><input type="checkbox" checked disabled />world</li></ul>`,
expected: `<dl><li><input type="checkbox" disabled />hello</li><br><li><input type="checkbox" checked disabled />world</li></dl>`,
},
}

Expand Down

0 comments on commit c40262b

Please sign in to comment.