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 {
} }
} }
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>" print "<li>" content "</li>"
}
} else { } else {
while (depth > 0) { while (depth > 0) {
print "</" cur_type[depth] ">" print "</" cur_type[depth] ">"

View File

@@ -19,7 +19,8 @@ It's meant to be a static site generator, like _[kew](https://github.com/uint23/
- Automatic inlining and embedding of many filetypes with `\![link]` or `\![alt](link)` - Automatic inlining and embedding of many filetypes with `\![link]` or `\![alt](link)`
- Inline html support - Inline html support
- MFM `$font` and `\<plain>` tags - MFM `$font` and `\<plain>` tags
- Admonition support (that's what the blocks like the warning block below are called) - GFM Admonition support (that's what the blocks like the warning block below are called)
- Task list support (`- [ ]`, `- [x]`)
- RSS/Feed generation and Sitemap support - RSS/Feed generation and Sitemap support
- Post creation via `--post` - Post creation via `--post`
- Automatic 404 page generation - Automatic 404 page generation

View File

@@ -274,3 +274,12 @@ hr {
padding-top: 30px; padding-top: 30px;
} }
} }
.task-list-item {
list-style-type: none;
}
.task-list-item-checkbox {
margin: 0 0.2em 0.25em -1.6em;
vertical-align: middle;
}