From 707916075efadc55ce432095c333b3025cd01321 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Tue, 23 Jul 2024 18:19:26 +0300 Subject: (single) Implemented reaodnly task lists --- single.awk | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'single.awk') diff --git a/single.awk b/single.awk index ac2eb7a..415e042 100644 --- a/single.awk +++ b/single.awk @@ -27,7 +27,7 @@ # [x] Superscript ^...^ # [x] Subscript ~...~ # [ ] Footnote [^...] (with user customizations) -# [ ] Task list - [ ] +# [x] Task list - [ ] (readonly) # [.] Definition lists # [x] Single line # [ ] Multi-line @@ -187,6 +187,14 @@ function autoinsert(arrname, isbefore) { /^( |\t)[ \t]*/ { } +# Check boxes +/^[ \t]*- \[[ x]\][ \t]/ { + match($0, /- \[[ x]\][ \t]/) + if (substr($0, RSTART + 3, 1) == "x") checked = " checked=\"checked\"" + else checked = "" + $0 = "" substr($0, RSTART + RLENGTH) "
" +} + # Unordered lists function abs(x) { return ((x < 0) ? -x : x) } !blankline && lengthStack("list-level") > 0 { -- cgit v1.3.1-23-gd82d