From 3c1994f07427b8b01c54195f524408d787c7da03 Mon Sep 17 00:00:00 2001 From: Rasmus Buurman Date: Tue, 20 Jan 2026 19:38:19 +0100 Subject: [PATCH 1/2] Add `skip` option for (sub)tasks --- CHANGELOG.md | 1 + src/task.typ | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b00bfaf..1ead769 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - Added `subtask` system - Added an argument `todo` in `#task` to mark task with TODO - Added `definition` environment and `example` environment +- Added `skip` option for `task` and `subtask` ## [0.4.0] - 2025-11-22 diff --git a/src/task.typ b/src/task.typ index b01a56f..73f5221 100644 --- a/src/task.typ +++ b/src/task.typ @@ -56,6 +56,12 @@ counter: auto, /// Whether to display the value of the task counter in the task's title. -> bool counter-show: true, + /// Step the task counter by the given number. + /// + /// This is applied after the general counter update (see `counter` parameter). + /// + /// -> none | int + skip: none, /// Whether to mark the task with a TODO box. -> bool todo: false, /// Whether to show a warning beside the title if there are any TODOs in the task. -> bool @@ -98,6 +104,9 @@ let c = std.counter if counter != auto { c("sheetstorm-task").update(counter) } + if skip != none and type(skip) == int { + c("sheetstorm-task").update(n => n + skip) + } let (points-number, points-display) = _handle_points(points) @@ -186,6 +195,12 @@ /// /// -> auto | int | function counter: auto, + /// Step the subtask counter by the given number. + /// + /// This is applied after the general counter update (see `counter` parameter). + /// + /// -> none | int + skip: none, /// The numbering patterns to use for the subtask markers depending on depth. /// /// This is an array of strings where the n-th element is the numbering pattern for subtasks of depth n. @@ -237,6 +252,14 @@ }) } + if skip != none and type(skip) == int { + state("sheetstorm-subtask").update(xs => { + let x = xs.pop() + xs.push(x + skip) + xs + }) + } + let marker = if marker != auto { marker } else { context { let depth = state("sheetstorm-subtask").get().len() - 1 From 1230f30bafaa8a72345f6b47a25c85bda43c3052 Mon Sep 17 00:00:00 2001 From: Rasmus Buurman Date: Tue, 20 Jan 2026 20:18:48 +0100 Subject: [PATCH 2/2] Use `skip` option in example --- examples/task-config.typ | 2 +- tests/examples/task-config/test.typ | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/task-config.typ b/examples/task-config.typ index 0280c9f..10816f8 100644 --- a/examples/task-config.typ +++ b/examples/task-config.typ @@ -37,4 +37,4 @@ #task(hidden: true, counter: 7)[This task is hidden in the score box.] -#task(counter: n => n + 1)[This would be task 8 but now it is task 9.] +#task(skip: 1)[This would be task 8 but now it is task 9.] diff --git a/tests/examples/task-config/test.typ b/tests/examples/task-config/test.typ index 38222be..8b07012 100644 --- a/tests/examples/task-config/test.typ +++ b/tests/examples/task-config/test.typ @@ -37,4 +37,4 @@ #task(hidden: true, counter: 7)[This task is hidden in the score box.] -#task(counter: n => n + 1)[This would be task 8 but now it is task 9.] +#task(skip: 1)[This would be task 8 but now it is task 9.]