Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format typst files and require correct formatting of PRs #205

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
17 changes: 17 additions & 0 deletions .github/workflows/check-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on:
pull_request:

jobs:
check-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Typstyle
uses: taiki-e/cache-cargo-install-action@v2
with:
tool: typstyle
- name: Format typst files
run: typstyle format-all
- uses: getsentry/action-git-diff-suggestions@main
with:
message: "Typstyle suggested change"
11 changes: 7 additions & 4 deletions book/src/dynamic/alternatives-cases.typ
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
*/

#slide[
#alternatives-cases(("1, 3", "2"), case => [
#set text(fill: teal) if case == 1
Some text
])
#alternatives-cases(
("1, 3", "2"),
case => [
#set text(fill: teal) if case == 1
Some text
],
)
]
12 changes: 8 additions & 4 deletions book/src/dynamic/alternatives-fn.typ
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
#set text(size: 50pt, font: "Atkinson Hyperlegible")

#slide[
We are on subslide:
#alternatives-fn(start: 2, count: 7, subslide => {
numbering("(i)", subslide)
})
We are on subslide:
#alternatives-fn(
start: 2,
count: 7,
subslide => {
numbering("(i)", subslide)
},
)
]
8 changes: 4 additions & 4 deletions book/src/dynamic/alternatives-match.typ
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#set text(size: 50pt, font: "Atkinson Hyperlegible")

#slide[
#alternatives-match((
"1, 3-5": [this text has the majority],
"2, 6": [this is shown less often]
))
#alternatives-match((
"1, 3-5": [this text has the majority],
"2, 6": [this is shown less often],
))
]
8 changes: 4 additions & 4 deletions book/src/dynamic/alternatives-position.typ
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#set text(size: 40pt, font: "Atkinson Hyperlegible")

#slide[
We know that
#alternatives(position: center + horizon)[$pi$][$sqrt(2)^2 + 1/3$]
is
#alternatives[irrational][rational].
We know that
#alternatives(position: center + horizon)[$pi$][$sqrt(2)^2 + 1 / 3$]
is
#alternatives[irrational][rational].
]
4 changes: 2 additions & 2 deletions book/src/dynamic/alternatives-repeat-last.typ
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#set text(size: 50pt, font: "Atkinson Hyperlegible")

#slide[
#alternatives(repeat-last: true)[temporary][transitory][ephemeral][permanent!]
#alternatives(repeat-last: true)[temporary][transitory][ephemeral][permanent!]

#uncover(5)[Did I miss something?]
#uncover(5)[Did I miss something?]
]
10 changes: 5 additions & 5 deletions book/src/dynamic/alternatives.typ
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
#set text(size: 40pt, font: "Atkinson Hyperlegible")

#slide[
#alternatives[Ann][Bob][Christopher]
likes
#alternatives[chocolate][strawberry][vanilla]
ice cream.
#alternatives[Ann][Bob][Christopher]
likes
#alternatives[chocolate][strawberry][vanilla]
ice cream.

#repeat[| #h(4cm)] // visual reference
#repeat[| #h(4cm)] // visual reference
]
16 changes: 8 additions & 8 deletions book/src/dynamic/cover.typ
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
#set text(size: 40pt, font: "Atkinson Hyperlegible")

#slide[
#uncover(3, mode: gray)[abc]
#uncover(3, mode: gray)[abc]

#one-by-one(start: 2, mode: gray)[def ][ghi]
#one-by-one(start: 2, mode: gray)[def ][ghi]

#item-by-item(mode: gray)[
- jkl
- mno
]
#item-by-item(mode: gray)[
- jkl
- mno
]

#show: later.with(mode: gray)
pqr
#show: later.with(mode: gray)
pqr

]
40 changes: 20 additions & 20 deletions book/src/dynamic/item-by-item-complex.typ
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@
#set text(size: 35pt, font: "Atkinson Hyperlegible")

#slide[
#show: columns.with(3)
#show: columns.with(3)

#set list(marker: sym.arrow)
#item-by-item[
- first
- second
- some
- detail
- third
]
#colbreak()
#set list(marker: sym.arrow)
#item-by-item[
- first
- second
- some
- detail
- third
]
#colbreak()

#item-by-item[
+ also
+ works
+ with `enums`
]
#colbreak()
#item-by-item[
+ also
+ works
+ with `enums`
]
#colbreak()

#item-by-item(start: 2)[
/ and: with
/ terms: too
]
#item-by-item(start: 2)[
/ and: with
/ terms: too
]
]
10 changes: 5 additions & 5 deletions book/src/dynamic/item-by-item.typ
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#set text(size: 50pt, font: "Atkinson Hyperlegible")

#slide[
#item-by-item[
- first
- second
- third
]
#item-by-item[
- first
- second
- third
]
]
10 changes: 5 additions & 5 deletions book/src/dynamic/later.typ
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#set text(size: 50pt, font: "Atkinson Hyperlegible")

#slide[
first
#show: later
second
#show: later
third
first
#show: later
second
#show: later
third
]
2 changes: 1 addition & 1 deletion book/src/dynamic/one-by-one-start.typ
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
#set text(size: 50pt, font: "Atkinson Hyperlegible")

#slide[
#one-by-one(start: 3)[This ][came ][pretty late.]
#one-by-one(start: 3)[This ][came ][pretty late.]
]
2 changes: 1 addition & 1 deletion book/src/dynamic/one-by-one.typ
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
#set text(size: 50pt, font: "Atkinson Hyperlegible")

#slide[
#one-by-one[Do you know ][$pi$ ][to a thousand decimal places?]
#one-by-one[Do you know ][$pi$ ][to a thousand decimal places?]
]
10 changes: 5 additions & 5 deletions book/src/dynamic/poor-alternatives.typ
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
#set text(size: 40pt, font: "Atkinson Hyperlegible")

#slide[
#only(1)[Ann] #only(2)[Bob] #only(3)[Christopher]
likes
#only(1)[chocolate] #only(2)[strawberry] #only(3)[vanilla]
ice cream.
#only(1)[Ann] #only(2)[Bob] #only(3)[Christopher]
likes
#only(1)[chocolate] #only(2)[strawberry] #only(3)[vanilla]
ice cream.

#repeat[| #h(4cm)] // visual reference
#repeat[| #h(4cm)] // visual reference
]
20 changes: 10 additions & 10 deletions book/src/dynamic/reveal-code.typ
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
#set text(size: 35pt, font: "Atkinson Hyperlegible")

#slide[
#reveal-code(lines: (1, 3, 6, 7))[```rust
pub fn main() {
let x = vec![3, 4, 1];
let y = &x;
if let Some(a) = x.first() {
dbg!(a);
} else {
println!("x is empty.");
#reveal-code(lines: (1, 3, 6, 7))[```rust
pub fn main() {
let x = vec![3, 4, 1];
let y = &x;
if let Some(a) = x.first() {
dbg!(a);
} else {
println!("x is empty.");
}
}
}
```]
```]
]
9 changes: 7 additions & 2 deletions book/src/dynamic/rule-interval.typ
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
#set text(size: 30pt, font: "Atkinson Hyperlegible")

#slide[
#only((beginning: 1, until: 5))[Content displayed on subslides 1, 2, 3, 4, and 5 \ ]
#only((beginning: 2))[Content displayed on subslide 2 and every following one \ ]
#only((
beginning: 1,
until: 5,
))[Content displayed on subslides 1, 2, 3, 4, and 5 \ ]
#only((
beginning: 2,
))[Content displayed on subslide 2 and every following one \ ]
#only((until: 3))[Content displayed on subslides 1, 2, and 3 \ ]
#only((:))[Content that is always displayed]
]
2 changes: 1 addition & 1 deletion book/src/dynamic/rule-string.typ
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
#set text(size: 40pt, font: "Atkinson Hyperlegible")

#slide[
#uncover("-2, 4, 6-8, 10-")[Polylux]
#uncover("-2, 4, 6-8, 10-")[Polylux]
]
8 changes: 3 additions & 5 deletions book/src/themes/gallery/metropolis.typ
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

#import themes.metropolis: *

#show: metropolis-theme.with(
footer: [Custom footer]
)
#show: metropolis-theme.with(footer: [Custom footer])

#set text(font: "Fira Sans", weight: "light", size: 20pt)
#show math.equation: set text(font: "Fira Math")
Expand All @@ -16,7 +14,7 @@
title: "Title",
subtitle: "Subtitle",
date: "Date",
extra: "Extra"
extra: "Extra",
)

#slide(title: "Table of contents")[
Expand All @@ -25,7 +23,7 @@

#slide(title: "Slide title")[
A slide with some maths:
$ x_(n+1) = (x_n + a/x_n) / 2 $
$ x_(n+1) = (x_n + a / x_n) / 2 $

#lorem(200)
]
Expand Down
4 changes: 1 addition & 3 deletions book/src/themes/gallery/simple.typ
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

#set text(font: "Inria Sans")

#show: simple-theme.with(
footer: [Simple slides],
)
#show: simple-theme.with(footer: [Simple slides])

#title-slide[
= Keep it simple!
Expand Down
2 changes: 1 addition & 1 deletion book/src/themes/gallery/university.typ
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
subtitle: "Subtitle",
date: "Date",
institution-name: "University Name",
logo: image("dummy-logo.png", width: 60mm)
logo: image("dummy-logo.png", width: 60mm),
)

#slide(title: [Slide title], new-section: [The section])[
Expand Down
2 changes: 1 addition & 1 deletion book/src/toolbox/big.typ
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
#set text(size: 40pt, font: "Atkinson Hyperlegible")

#slide[
#toolbox.big[BIG]
#toolbox.big[BIG]
]
10 changes: 8 additions & 2 deletions book/src/toolbox/full-width.typ
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
#set page(
paper: "presentation-16-9",
margin: 2cm,
header: align(top, toolbox.full-width-block(fill: aqua, inset: 8pt)[I'm up high]),
footer: align(bottom, toolbox.full-width-block(fill: lime, inset: 8pt)[I'm down low]),
header: align(
top,
toolbox.full-width-block(fill: aqua, inset: 8pt)[I'm up high],
),
footer: align(
bottom,
toolbox.full-width-block(fill: lime, inset: 8pt)[I'm down low],
),
)

#slide[
Expand Down
2 changes: 1 addition & 1 deletion book/src/toolbox/next-heading.typ
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#set page(
paper: "presentation-16-9",
header: toolbox.next-heading(h => underline(h))
header: toolbox.next-heading(h => underline(h)),
)

#show heading.where(level: 1): none
Expand Down
2 changes: 1 addition & 1 deletion book/src/toolbox/progress.typ
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
toolbox.progress-ratio(ratio => {
stack(
dir: ltr,
rect(stroke: blue, fill: blue, width: ratio * 8cm),
rect(stroke: blue, fill: blue, width: ratio * 8cm),
rect(stroke: blue, fill: none, width: (1 - ratio) * 8cm),
)
})
Expand Down
6 changes: 2 additions & 4 deletions book/src/toolbox/sections-band.typ
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
#set page(paper: "presentation-16-9")
#set text(size: 40pt, font: "Atkinson Hyperlegible")

#let sections-band = toolbox.all-sections( (sections, current) => {
#let sections-band = toolbox.all-sections((sections, current) => {
set text(fill: gray, size: .8em)
sections
.map(s => if s == current { strong(s) } else { s })
.join([ • ])
sections.map(s => if s == current { strong(s) } else { s }).join([ • ])
})

#set page(footer: sections-band)
Expand Down
Loading