fix linting issues

This commit is contained in:
Christoph Herb
2024-10-11 00:06:20 +02:00
parent 95cd0b562e
commit 6251205cf1

View File

@@ -91,11 +91,15 @@ func renderHookBlockquote(w io.Writer, node ast.Node, entering bool) (ast.WalkSt
}
// Set the message type based on the content of the blockquote
var err error
if entering {
s, _ := createBlockquoteStart(alert)
io.WriteString(w, s)
_, err = io.WriteString(w, s)
} else {
io.WriteString(w, "</div>")
_, err = io.WriteString(w, "</div>")
}
if err != nil {
log.Println("Error:", err)
}
return ast.GoToNext, true
@@ -115,7 +119,10 @@ func renderHookText(w io.Writer, node ast.Node) (ast.WalkStatus, bool) {
for _, b := range blockquotes {
content, found := strings.CutPrefix(string(block.Literal), fmt.Sprintf("[!%s]", strings.ToUpper(b)))
if found {
io.WriteString(w, content)
_, err := io.WriteString(w, content)
if err != nil {
log.Println("Error:", err)
}
return ast.GoToNext, true
}
}
@@ -126,15 +133,20 @@ func renderHookText(w io.Writer, node ast.Node) (ast.WalkStatus, bool) {
content, found := strings.CutPrefix(string(block.Literal), "[ ]")
content = `<input type="checkbox" disabled class="task-list-item-checkbox"> ` + content
if found {
io.WriteString(w, content)
_, err := io.WriteString(w, content)
if err != nil {
log.Println("Error:", err)
}
return ast.GoToNext, true
}
content, found = strings.CutPrefix(string(block.Literal), "[x]")
content = `<input type="checkbox" disabled class="task-list-item-checkbox" checked> ` + content
if found {
io.WriteString(w, content)
return ast.GoToNext, true
_, err := io.WriteString(w, content)
if err != nil {
log.Println("Error:", err)
}
}
}
@@ -159,9 +171,15 @@ func renderHookListItem(w io.Writer, node ast.Node, entering bool) (ast.WalkStat
}
if entering {
io.WriteString(w, "<li class=\"task-list-item\">")
_, err := io.WriteString(w, "<li class=\"task-list-item\">")
if err != nil {
log.Println("Error:", err)
}
} else {
io.WriteString(w, "</li>")
_, err := io.WriteString(w, "</li>")
if err != nil {
log.Println("Error:", err)
}
}
return ast.GoToNext, true