Summary Files Commits Branches @commit @diff @stats
path: root / single.awk
diff options
context:
space:
mode:
Commit7dc4331d9309a1427051b2aa48fee4556f8a1c3a (patch)
Author
 Syndamia <kamen@syndamia.com>
2025-01-01 11:45:56 +0200
Committer
 Syndamia <kamen@syndamia.com>
2025-01-01 11:45:56 +0200
Files2fb76a95c6af4ab7290312786e69034932dff110 /single.awk
csg-7dc4331d9309a1427051b2aa48fee4556f8a1c3a.tar
csg-7dc4331d9309a1427051b2aa48fee4556f8a1c3a.tar.gz
csg-7dc4331d9309a1427051b2aa48fee4556f8a1c3a.zip
Parent784f8c91c436d4f90d3af12e2790e60ef082601c (diff)
feat(single): Implemented checklists
1 files changed, 8 insertions, 1 deletions
-rw-r--r--single.awk9
diff --git a/single.awk b/single.awk
index 0481a49..b4b4c89 100644
--- a/single.awk
+++ b/single.awk
@@ -11,7 +11,7 @@
# [x] Superscript ^...^
# [x] Subscript ~...~
# [ ] Footnote [^...] (with user customizations)
-# [ ] Task list - [ ] (readonly)
+# [x] Task list - [ ] (readonly)
# [ ] Definition lists
# [ ] Single line
# [ ] Multi-line
@@ -219,6 +219,13 @@ list_level > 0 && !list_started && /[^ \t]/ { ## Non-list line
}
}
+# Checklists
+list_started && /^\[[x ]\][ \t]/ {
+ checked = (char($0, 2) == "x") ? " checked=\"checked\"" : "";
+ $0 = "<input type=\"checkbox\" disabled=\"disabled\"" checked \
+ "><label>" substr($0, 5) "</label>"
+}
+
# Code blocks
/^( |\t)/ {
if (!inside_codeblock) {