Skip to content
Open
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 packages/preview/tally/0.1.2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test.typ
8 changes: 8 additions & 0 deletions packages/preview/tally/0.1.2/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# v0.1.2
- Fix layout convergence error

# v0.1.1
- Made the `todo-list` a seperate variable instead of just putting it with the show rule

# v0.1.0
- Initial release
22 changes: 22 additions & 0 deletions packages/preview/tally/0.1.2/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2025 Tijme

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

22 changes: 22 additions & 0 deletions packages/preview/tally/0.1.2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# The `tally` Package

The tally package automatically lists all todos in a document and highlights them.

## Usage

```typst
#import "@preview/tally:0.1.1": tally, todo-list
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version seems to be out of date

#set text(font: "Barlow")
#show: tally.with(color: red)

#todo-list

= Introduction
#lorem(10)

TODO: Create introduction
```

Output:

![image](https://github.com/user-attachments/assets/bbe787ea-11c7-402f-9e54-b207499f5e00)
33 changes: 33 additions & 0 deletions packages/preview/tally/0.1.2/src/lib.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#let tally(body, color: yellow) = {
let todo-list = state("todo-list", ())
let reg = regex("TODO:(.+)")
show reg: it => context {
let todo = it.text.match(reg).captures.at(0).trim()
let here = here()
todo-list.update(lst => lst + ((todo, here),))
highlight(fill: color)[TODO: #todo]
}

body
}

#let todo-list = context {
let todo-list = state("todo-list", ())
if todo-list.final().len() > 0 {
heading(outlined: false, [Todo])
}
list(
..todo-list
.final()
.map(it => link(
it.last(),
[#{
let headings = query(selector(heading).before(it.last()))

if headings.len() > 1 {
[*#headings.last().body*:]
}
} #it.first()],
)),
)
}
18 changes: 18 additions & 0 deletions packages/preview/tally/0.1.2/typst.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "tally"
version = "0.1.2"
entrypoint = "src/lib.typ"
authors = ["Tijme"]
license = "MIT"
description = "Automatically handle todos in your document."
repository = "https://github.com/7ijme/tally"
keywords = ["todo", "list"]
categories = ["utility"]
exclude = [
".github",
"docs",
"scripts",
"tests",
".typstignore",
"Justfile",
]