Skip to content

Commit

Permalink
Add support for typstyle (#313)
Browse files Browse the repository at this point in the history
Formatter for typst

https://github.com/Enter-tainer/typstyle

Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
  • Loading branch information
dalugm and raxod502 committed Sep 3, 2024
1 parent 358deff commit e2e9b39
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog].

## Unreleased
### Formatters
* [`typstyle`](https://github.com/Enter-tainer/typstyle) for
[typst](https://typst.app/) ([#313]).
* [`rubocop`](https://github.com/rubocop/rubocop) changed to use `-a`
instead of deprecated `--auto-correct` ([#316]).

Expand All @@ -22,6 +24,7 @@ The format is based on [Keep a Changelog].
write tests that have additional data files ([#301]).

[#301]: https://github.com/radian-software/apheleia/pull/301
[#313]: https://github.com/radian-software/apheleia/pull/313
[#316]: https://github.com/radian-software/apheleia/pull/316

## 4.2 (released 2024-08-03)
Expand Down
3 changes: 3 additions & 0 deletions apheleia-formatters.el
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@
(rustfmt . ("rustfmt" "--quiet" "--emit" "stdout"))
(terraform . ("terraform" "fmt" "-"))
(treefmt . ("treefmt" "--stdin" filepath))
(typstyle . ("typstyle"))
(xmllint . ("xmllint" "--format" "-"))
(yapf . ("yapf"))
(yq-csv . ("yq" "--prettyPrint" "--no-colors"
Expand Down Expand Up @@ -364,6 +365,8 @@ rather than using this system."
(tuareg-mode . ocamlformat)
(typescript-mode . prettier-typescript)
(typescript-ts-mode . prettier-typescript)
(typst-mode . typstyle)
(typst-ts-mode . typstyle)
(web-mode . prettier)
(yaml-mode . prettier-yaml)
(yaml-ts-mode . prettier-yaml)
Expand Down
4 changes: 4 additions & 0 deletions test/formatters/installers/typstyle.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ver="$(latest_release Enter-tainer/typstyle)"

wget "https://github.com/Enter-tainer/typstyle/releases/download/${ver}/typstyle-x86_64-unknown-linux-gnu " -O /usr/local/bin/typstyle
chmod +x /usr/local/bin/typstyle
10 changes: 10 additions & 0 deletions test/formatters/samplecode/typstyle/in.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#{
let (title,
_) = query(heading.where(level:
1)).map(e => (
e.body,
e.location()
.page(),
)).rev().find(((_, v)) => v
<= page)
}
9 changes: 9 additions & 0 deletions test/formatters/samplecode/typstyle/out.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#{
let (title, _) = query(heading.where(level: 1))
.map(e => (
e.body,
e.location().page(),
))
.rev()
.find(((_, v)) => v <= page)
}

0 comments on commit e2e9b39

Please sign in to comment.