Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- Added an argument `todo` in `#task` to mark task with TODO
- Added `definition` environment and `example` environment
- Added task text handling
- Added `begin-at-new-page` option for `task` and `subtask`

## [0.4.0] - 2025-11-22

Expand Down
31 changes: 31 additions & 0 deletions src/task.typ
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@
points-show: true,
/// The word that is displayed before the points. -> content | str
points-prefix: context i18n.translate("Points"),
/// Whether to insert a colbreak before the task.
///
/// Technically, this breaks the column and not the page
/// but a single-column layout is assumed.
///
/// This does not apply to the very first task
/// where it usually makes no sense to break before.
///
/// -> bool
begin-at-new-page: false,
/// Whether the task is a bonus task. -> bool
bonus: false,
/// Whether bonus tasks are marked with a star in the title. -> bool
Expand Down Expand Up @@ -155,6 +165,16 @@
}
}

// maybe colbreak before task
context {
let is-first-task = (
query(selector(<sheetstorm-task>).before(here())).len() == 0
)
if begin-at-new-page and not is-first-task {
colbreak(weak: true)
}
}

block(width: 100%, above: space-above, below: space-below)[
#if label != none {
if supplement == auto { supplement = task-prefix }
Expand Down Expand Up @@ -244,6 +264,13 @@
///
/// -> length
min-indent: 1.2em,
/// Whether to insert a colbreak before the subtask.
///
/// Technically, this breaks the column and not the page
/// but a single-column layout is assumed.
///
/// -> bool
begin-at-new-page: false,
/// A function that provides styling to the description of a subtask. -> function
task-text-style: emph,
/// The body of the subtask.
Expand Down Expand Up @@ -303,6 +330,10 @@
}
}

if begin-at-new-page {
colbreak(weak: true)
}

grid(
columns: (auto, auto, 1fr),
column-gutter: 0em,
Expand Down
Loading