feat: task lists
All checks were successful
Lint / shellcheck (push) Successful in 18s

This commit is contained in:
2026-03-20 08:32:28 +01:00
parent cc7fee573f
commit de8cbefb8e
3 changed files with 31 additions and 2 deletions

View File

@@ -48,7 +48,26 @@ BEGIN {
}
}
print "<li>" content "</li>"
has_checkbox = 0
if (content ~ /^\[[ \t]\] /) {
has_checkbox = 1
is_checked = 0
sub(/^\[[ \t]\] /, "", content)
} else if (content ~ /^\[[xX]\] /) {
has_checkbox = 1
is_checked = 1
sub(/^\[[xX]\] /, "", content)
}
if (has_checkbox) {
if (is_checked) {
print "<li class=\"task-list-item\"><input type=\"checkbox\" class=\"task-list-item-checkbox\" checked disabled> " content "</li>"
} else {
print "<li class=\"task-list-item\"><input type=\"checkbox\" class=\"task-list-item-checkbox\" disabled> " content "</li>"
}
} else {
print "<li>" content "</li>"
}
} else {
while (depth > 0) {
print "</" cur_type[depth] ">"