From de8cbefb8ef90cdf53f2a0cb16d501b882e803a8 Mon Sep 17 00:00:00 2001 From: "N0\\A" Date: Fri, 20 Mar 2026 08:32:28 +0100 Subject: [PATCH] feat: task lists --- awk/lists.awk | 21 ++++++++++++++++++++- site/index.md | 3 ++- styles/kewt.css | 9 +++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/awk/lists.awk b/awk/lists.awk index 36c0b9a..e3d4b83 100644 --- a/awk/lists.awk +++ b/awk/lists.awk @@ -48,7 +48,26 @@ BEGIN { } } - print "
  • " content "
  • " + 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 "
  • " content "
  • " + } else { + print "
  • " content "
  • " + } + } else { + print "
  • " content "
  • " + } } else { while (depth > 0) { print "" diff --git a/site/index.md b/site/index.md index 8e06dcf..186f16b 100644 --- a/site/index.md +++ b/site/index.md @@ -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)` - Inline html support - MFM `$font` and `\` 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 - Post creation via `--post` - Automatic 404 page generation diff --git a/styles/kewt.css b/styles/kewt.css index e250723..fadedad 100644 --- a/styles/kewt.css +++ b/styles/kewt.css @@ -273,4 +273,13 @@ hr { margin-right: 20px; 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; } \ No newline at end of file