Skip to content

Commit

Permalink
Add support for typstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
dalugm committed Aug 16, 2024
1 parent 3e347cf commit 4d5547b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog].

## Unreleased
### Formatters
* [`typstyle`](https://github.com/Enter-tainer/typstyle) for
[typst](https://typst.app/) ([#313]).

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

## 4.2 (released 2024-08-03)
### Changes
* Custom Emacs Lisp formatting functions have the option to report an
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 4d5547b

Please sign in to comment.