feat: enhance modern template task hints

This commit is contained in:
Popa committed 2026-10-29 21:10:22 +01:00
1 parent 08232f43ed
commit 27c77fe56c
1 file changed
+12 -14
+12 -14
View File
@@ -24,15 +24,15 @@
#let doc-id = sys.inputs.at("doc-id", default: none)
#let task(points: none, title, body) = context {
#let task(points: none, title, body, col: none, label: none) = context {
subtask-indent.update((0,))
let theme = theme-state.get()
let text-color = theme.primary
let header-font = theme.sans-font
let border-color = theme.primary
let background-color = theme.secondary.transparentize(75%)
let task-label = task-label-state.get()
let background-color = theme.primary.transparentize(95%)
let task-label = if label == none { task-label-state.get() } else { label }
let subtask-points = query(
selector(metadata).within(here()),
@@ -154,34 +154,32 @@
})
}
#let hint(label: none, body) = context {
#let hint(label: none, col: none, body) = context {
let theme = theme-state.get()
let hint-label = if label != none and label != [] { label } else { hint-label-state.get() }
let col = if col == none { theme.accent } else { col }
let in-task = task-active.get()
let indent = subtask-indent.get()
let in-subtask = in-task and indent.len() == 1
let in-subtask = in-task and indent.len() >= 1
let offset = 0.75em
let hint-block = block(
breakable: true,
stroke: (left: (paint: theme.accent, thickness: 0.25em)),
fill: theme.accent.transparentize(90%),
stroke: (left: (paint: col, thickness: 0.25em)),
fill: col.transparentize(90%),
inset: (y: 0.75em, left: offset, right: 1em),
width: if in-subtask { 100% - 0.25em } else { 100% + offset },
width: if in-subtask { 100% + offset } else { 100% },
[
#text(size: 8pt, weight: 600, fill: theme.accent.darken(25%), text(font: theme.sans-font, hint-label)) \
#text(size: 8pt, weight: 600, fill: col.darken(25%), text(font: theme.sans-font, hint-label)) \
#body
],
)
if in-subtask {
move(dx: 0.25em, hint-block)
} else {
move(dx: -offset, hint-block)
}
if in-subtask { move(dx: -offset, hint-block) } else { hint-block }
}