diff --git a/layouts/partials/function/checkbox.html b/layouts/partials/function/checkbox.html deleted file mode 100644 index 1b636bb4..00000000 --- a/layouts/partials/function/checkbox.html +++ /dev/null @@ -1,9 +0,0 @@ -{{- /* Checkbox unchecked */ -}} -{{- $old := `` -}} -{{- $new := dict "Class" "fa-regular fa-square fa-fw" | partial "plugin/icon.html" -}} -{{- $content := replace . $old $new -}} - -{{- /* Checkbox checked */ -}} -{{- $old = `` -}} -{{- $new := dict "Class" "fa-regular fa-check-square fa-fw" | partial "plugin/icon.html" -}} -{{- return replace $content $old $new -}} diff --git a/layouts/partials/function/content.html b/layouts/partials/function/content.html index b232c432..426b653c 100644 --- a/layouts/partials/function/content.html +++ b/layouts/partials/function/content.html @@ -14,7 +14,7 @@ {{- $content = partial "function/fontawesome.html" $content -}} {{- end -}} - {{- $content = partial "function/checkbox.html" $content -}} + {{- $content = partial "function/task-lists.html" $content -}} {{- $content = partial "function/escape.html" $content -}} diff --git a/layouts/partials/function/task-lists.html b/layouts/partials/function/task-lists.html new file mode 100644 index 00000000..d33e0cf7 --- /dev/null +++ b/layouts/partials/function/task-lists.html @@ -0,0 +1,38 @@ +{{- /* Task lists rendering */ -}} +{{- /* If Hugo supports the list rendering hook, refactor this snippet. */ -}} + +{{- $iconMap := dict + " " "fa-regular fa-square" + "x" "fa-solid fa-check-square" + ">" "fa-solid fa-calendar" + "<" "fa-solid fa-calendar-check" +-}} +{{- $extendedSigns := slice -}} +{{- range $sign, $icon := $iconMap -}} + {{- $extendedSigns = $extendedSigns | append $sign -}} +{{- end -}} + +{{- /* + The basic syntax is compatible with GitHub, Obsidian, and Typora. + The basic format is as follows: + - [ ] Unchecked + - [x] Checked +*/ -}} +{{- $icon := dict "Class" (add "checkbox-icon fa-fw " (index $iconMap " ")) | partial "plugin/icon.html" -}} +{{- $content := replaceRE `