Skip to content

Commit

Permalink
Merge pull request #533 from hugo-fixit/feat/task-lists
Browse files Browse the repository at this point in the history
🎉 Feat: support Obsidian style task lists

Closes #532
  • Loading branch information
Lruihao authored Nov 2, 2024
2 parents 8d10880 + 3a5d0de commit 85d91b8
Show file tree
Hide file tree
Showing 20 changed files with 265 additions and 11 deletions.
4 changes: 3 additions & 1 deletion assets/css/_core/_root.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
:root {
// Note: Custom variable values only support SassScript inside `#{}`.

// Theme colors varibles
// Theme colors variables
@each $color, $value in $theme-colors {
--#{$prefix}#{$color}: #{$value};
}
Expand All @@ -22,6 +22,8 @@
--#{$prefix}scrollbar-track-color: transparent;
--#{$prefix}scrollbar-width: thin;
--#{$prefix}scrollbar-width-legacy: 12px;

// TODO migrate SCSS variables to CSS variables
}

// Dark theme
Expand Down
32 changes: 32 additions & 0 deletions assets/css/_page/_single.scss
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,38 @@

ul {
list-style-type: disc;

// Task lists
li[data-task] {
list-style: none;
margin-left: -1.5rem;
}
}

// Task lists
li[data-task] {
color: var(--#{$prefix}task-color);
.checkbox-icon {
margin-right: 0.25em;
color: var(--#{$prefix}checkbox-color);
}
}
li[data-task='x'],
li[data-task='-'] {
--#{$prefix}task-color: var(--#{$prefix}secondary);
text-decoration: line-through;
}
li[data-task='x'] {
--#{$prefix}checkbox-color: var(--#{$prefix}primary);
}
li[data-task='/'] {
--#{$prefix}task-color: var(--#{$prefix}success);
}
li[data-task='!'] {
--#{$prefix}checkbox-color: var(--#{$prefix}danger);
}
li[data-task='?'] {
--#{$prefix}checkbox-color: var(--#{$prefix}warning);
}

dl {
Expand Down
6 changes: 6 additions & 0 deletions hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,12 @@ enableEmoji = true
# syntax: <type> = <icon>
[params.admonition]
# ban = "fa-solid fa-ban"

# FixIt 0.3.14 | NEW Task lists custom config
# See https://fixit.lruihao.cn/documentation/content-management/advanced/#custom-task-lists
# syntax: <sign> = <icon>
[params.taskList]
# tip = "fa-regular fa-lightbulb"

# FixIt 0.2.12 | NEW PanguJS config
[params.pangu]
Expand Down
12 changes: 12 additions & 0 deletions i18n/de.toml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,18 @@ warning = ""
caution = ""
# === GitHub Alert ===

# === Task lists ===
[taskList]
" " = ""
"x" = ""
"/" = ""
"-" = ""
"<" = ""
">" = ""
"!" = ""
"?" = ""
# === Task lists ===

# === shortcodes/admonition.html ===
[admonition]
note = "Notiz"
Expand Down
12 changes: 12 additions & 0 deletions i18n/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,18 @@ warning = "Warning"
caution = "Caution"
# === GitHub Alert ===

# === Task lists ===
[taskList]
" " = "Unchecked"
"x" = "Checked"
"/" = "In Progress"
"-" = "Cancelled"
"<" = "Scheduled"
">" = "Rescheduled"
"!" = "Important"
"?" = "Question"
# === Task lists ===

# === shortcodes/admonition.html ===
[admonition]
note = "Note"
Expand Down
12 changes: 12 additions & 0 deletions i18n/es.toml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,18 @@ warning = ""
caution = ""
# === GitHub Alert ===

# === Task lists ===
[taskList]
" " = ""
"x" = ""
"/" = ""
"-" = ""
"<" = ""
">" = ""
"!" = ""
"?" = ""
# === Task lists ===

# === shortcodes/admonition.html ===
[admonition]
note = "Nota"
Expand Down
12 changes: 12 additions & 0 deletions i18n/fr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,18 @@ warning = ""
caution = ""
# === GitHub Alert ===

# === Task lists ===
[taskList]
" " = ""
"x" = ""
"/" = ""
"-" = ""
"<" = ""
">" = ""
"!" = ""
"?" = ""
# === Task lists ===

# === shortcodes/admonition.html ===
[admonition]
note = "Remarque"
Expand Down
12 changes: 12 additions & 0 deletions i18n/hi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,18 @@ warning = ""
caution = ""
# === GitHub Alert ===

# === Task lists ===
[taskList]
" " = ""
"x" = ""
"/" = ""
"-" = ""
"<" = ""
">" = ""
"!" = ""
"?" = ""
# === Task lists ===

# === shortcodes/admonition.html ===
[admonition]
note = "ध्यान दें"
Expand Down
12 changes: 12 additions & 0 deletions i18n/it.toml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,18 @@ warning = ""
caution = ""
# === GitHub Alert ===

# === Task lists ===
[taskList]
" " = ""
"x" = ""
"/" = ""
"-" = ""
"<" = ""
">" = ""
"!" = ""
"?" = ""
# === Task lists ===

# === shortcodes/admonition.html ===
[admonition]
note = "Note"
Expand Down
12 changes: 12 additions & 0 deletions i18n/pl.toml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,18 @@ warning = ""
caution = ""
# === GitHub Alert ===

# === Task lists ===
[taskList]
" " = ""
"x" = ""
"/" = ""
"-" = ""
"<" = ""
">" = ""
"!" = ""
"?" = ""
# === Task lists ===

# === shortcodes/admonition.html ===
[admonition]
note = "Notka"
Expand Down
12 changes: 12 additions & 0 deletions i18n/pt-BR.toml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,18 @@ warning = ""
caution = ""
# === GitHub Alert ===

# === Task lists ===
[taskList]
" " = ""
"x" = ""
"/" = ""
"-" = ""
"<" = ""
">" = ""
"!" = ""
"?" = ""
# === Task lists ===

# === shortcodes/admonition.html ===
[admonition]
note = "Nota"
Expand Down
12 changes: 12 additions & 0 deletions i18n/ro.toml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,18 @@ warning = ""
caution = ""
# === GitHub Alert ===

# === Task lists ===
[taskList]
" " = ""
"x" = ""
"/" = ""
"-" = ""
"<" = ""
">" = ""
"!" = ""
"?" = ""
# === Task lists ===

# === shortcodes/admonition.html ===
[admonition]
note = "Notă"
Expand Down
12 changes: 12 additions & 0 deletions i18n/ru.toml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,18 @@ warning = ""
caution = ""
# === GitHub Alert ===

# === Task lists ===
[taskList]
" " = ""
"x" = ""
"/" = ""
"-" = ""
"<" = ""
">" = ""
"!" = ""
"?" = ""
# === Task lists ===

# === shortcodes/admonition.html ===
[admonition]
note = "Замечание"
Expand Down
12 changes: 12 additions & 0 deletions i18n/sr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,18 @@ warning = ""
caution = ""
# === GitHub Alert ===

# === Task lists ===
[taskList]
" " = ""
"x" = ""
"/" = ""
"-" = ""
"<" = ""
">" = ""
"!" = ""
"?" = ""
# === Task lists ===

# === shortcodes/admonition.html ===
[admonition]
note = "Напомена"
Expand Down
12 changes: 12 additions & 0 deletions i18n/vi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,18 @@ warning = ""
caution = ""
# === GitHub Alert ===

# === Task lists ===
[taskList]
" " = ""
"x" = ""
"/" = ""
"-" = ""
"<" = ""
">" = ""
"!" = ""
"?" = ""
# === Task lists ===

# === shortcodes/admonition.html ===
[admonition]
note = "Ghi chú"
Expand Down
12 changes: 12 additions & 0 deletions i18n/zh-CN.toml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,18 @@ warning = "警告"
caution = "小心"
# === GitHub Alert ===

# === Task lists ===
[taskList]
" " = "未完成"
"x" = "已完成"
"/" = "进行中"
"-" = "已取消"
"<" = "已计划"
">" = "已重新计划"
"!" = "重要"
"?" = "问题"
# === Task lists ===

# === shortcodes/admonition.html ===
[admonition]
note = "注意"
Expand Down
12 changes: 12 additions & 0 deletions i18n/zh-TW.toml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,18 @@ warning = "警告"
caution = "小心"
# === GitHub Alert ===

# === Task lists ===
[taskList]
" " = "未完成"
"x" = "已完成"
"/" = "進行中"
"-" = "已取消"
"<" = "已計劃"
">" = "已重新計劃"
"!" = "重要"
"?" = "問題"
# === Task lists ===

# === shortcodes/admonition.html ===
[admonition]
note = "注意"
Expand Down
9 changes: 0 additions & 9 deletions layouts/partials/function/checkbox.html

This file was deleted.

2 changes: 1 addition & 1 deletion layouts/partials/function/content.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}

Expand Down
Loading

0 comments on commit 85d91b8

Please sign in to comment.