Skip to content

Commit

Permalink
refactor: try BlockNodeConverter
Browse files Browse the repository at this point in the history
Can't use because requires popping the class Key
  • Loading branch information
KyleKing committed Jan 2, 2025
1 parent ea3f76f commit ab4b5a7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions djot_parser/djot_html.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,16 @@ var DefaultConversionRegistry = map[DjotNode]Conversion{
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.Node.Attributes.Set(djot_tokenizer.DjotAttributeClassKey, "")
s.BlockNodeConverter("li", (func(c Children) {
s.Writer.WriteString("<input disabled=\"\" type=\"checkbox\"")
if class == CheckedTaskItemClass {
s.Writer.WriteString(" checked=\"\"")
}
s.Writer.WriteString("/>").WriteString("\n")
n(s.Node.Children[:1])
s.Writer.WriteString("\n")
}).WriteString("\n")
}))
} else {
s.BlockNodeConverter("li", n)
}
Expand Down

0 comments on commit ab4b5a7

Please sign in to comment.