fix(task-lists): regular expression matching for task list items containing extra spaces

This commit is contained in:
Cell
2026-02-28 17:45:30 +08:00
parent 3926cc0220
commit 2199c7f125
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -331,7 +331,7 @@ header {
.menu {
background-color: fixit-var(header-background-color);
border-top: 2px solid fixit-var(global-border-color);
border-top: 1px solid fixit-var(global-border-color);
display: none;
overflow-y: auto;
max-height: 70vh;
+3 -3
View File
@@ -28,10 +28,10 @@
*/ -}}
{{- $icon := dict "Class" (add "checkbox-icon " (index $iconMap " ")) | partial "plugin/icon.html" -}}
{{- $label := T (printf "taskList.%v" " ") -}}
{{- $content := replaceRE `(?s)<li>((\n<p>)*)<input disabled="" type="checkbox">` (printf `<li data-task=" " title=%q>$1%s` $label $icon) . -}}
{{- $content := replaceRE `(?s)<li>((\n<p>)*)<input disabled="" type="checkbox">\s?` (printf `<li data-task=" " title=%q>$1%s` $label $icon) . -}}
{{- $label := T (printf "taskList.%v" "x") -}}
{{- $icon := dict "Class" (add "checkbox-icon " (index $iconMap "x")) | partial "plugin/icon.html" -}}
{{- $content = replaceRE `(?s)<li>((\n<p>)*)<input checked="" disabled="" type="checkbox">` (printf `<li data-task="x" title=%q>$1%s` $label $icon) $content -}}
{{- $content = replaceRE `(?s)<li>((\n<p>)*)<input checked="" disabled="" type="checkbox">\s?` (printf `<li data-task="x" title=%q>$1%s` $label $icon) $content -}}
{{- /*
The extended syntax is compatible with Obsidian.
@@ -49,7 +49,7 @@
{{- $sign := htmlEscape . -}}
{{- $originSign := replace . "\\" "" -}}
{{- $label := (T (printf "taskList.%v" $originSign)) | default (T (printf "taskList.%v" " ")) -}}
{{- $content = replaceRE (printf `(?s)<li>((\n<p>)*)\[%s\]` $sign) (printf `<li data-task=%q title=%q>$1%s` $originSign $label $icon) $content -}}
{{- $content = replaceRE (printf `(?s)<li>((\n<p>)*)\[%s\]\s?` $sign) (printf `<li data-task=%q title=%q>$1%s` $originSign $label $icon) $content -}}
{{- end -}}
{{- return $content -}}
+1 -1
View File
@@ -1,4 +1,4 @@
{{- hugo.Store.Set "version" "v0.4.3-20260130042349-e23a50d7" -}}
{{- hugo.Store.Set "version" "v0.4.3-20260228095958-63cc207f" -}}
{{- .Store.Set "this" dict -}}
{{- partial "init/detection-env.html" . -}}