diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 90598ab..b034d9d 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -20,7 +20,7 @@ jobs: go-version-file: go.mod - name: golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v6 with: { version: latest } test: diff --git a/djot_parser/djot_html.go b/djot_parser/djot_html.go index 85e6cbb..5f67d83 100644 --- a/djot_parser/djot_html.go +++ b/djot_parser/djot_html.go @@ -91,7 +91,22 @@ var DefaultConversionRegistry = map[DjotNode]Conversion{ DefinitionListNode: func(s ConversionState, n func(c Children)) { s.BlockNodeConverter("dl", n) }, UnorderedListNode: func(s ConversionState, n func(c Children)) { s.BlockNodeConverter("ul", n) }, OrderedListNode: func(s ConversionState, n func(c Children)) { s.BlockNodeConverter("ol", n) }, - ListItemNode: func(s ConversionState, n func(c Children)) { s.BlockNodeConverter("li", n) }, + ListItemNode: func(s ConversionState, n func(c Children)) { + class := s.Node.Attributes.Get(djot_tokenizer.DjotAttributeClassKey) + if class == CheckedTaskItemClass || class == UncheckedTaskItemClass { + s.Writer.InTag("li")(func() { + s.Writer.WriteString("\n") + s.Writer.WriteString("").WriteString("\n") + n(s.Node.Children) + }).WriteString("\n") + } else { + s.BlockNodeConverter("li", n) + } + }, DefinitionTermNode: func(s ConversionState, n func(c Children)) { s.InlineNodeConverter("dt", n) s.Writer.WriteString("\n") diff --git a/djot_parser/examples/todo-list.djot b/djot_parser/examples/todo-list.djot index 2d8e7aa..314c604 100644 --- a/djot_parser/examples/todo-list.djot +++ b/djot_parser/examples/todo-list.djot @@ -1,3 +1,8 @@ - [ ] unchecked + + * 1 + * 2 + * 3 - [x] checked -- [ ] finish \ No newline at end of file +- [ ] Inline _formatting ([link](https://google.com))_ +- [ ] finish diff --git a/djot_parser/examples/todo-list.html b/djot_parser/examples/todo-list.html index c3c19bb..7e51530 100644 --- a/djot_parser/examples/todo-list.html +++ b/djot_parser/examples/todo-list.html @@ -1,11 +1,29 @@
an unchecked task list item
+with two paragraphs
+checked item
+