Typst rules based on ast-grep
$ just scan glossarium/0.5.8
ast-grep scan …/preview/glossarium/0.5.8
warning[show-function]:
┌─ …/preview/glossarium/0.5.8/themes/default.typ:1361:5
│
1361 │ show ref: refrule.with(update: false)
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning[show-function]:
┌─ …/preview/glossarium/0.5.8/themes/default.typ:901:3
│
901 │ ╭ show figure.where(kind: __glossarium_figure): it => {
│ │ ╭─────────────────────────────────────────────────'
902 │ │ │ align(start, it.body)
903 │ │ │ }
│ ╰─│───^
│ ╰───'
note[context]:
┌─ …/preview/glossarium/0.5.8\themes\default.typ:568:35
│
568 │ #let style-entries(attr, style) = context _style-entries(attr, style)
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note[stateful]:
┌─ …/preview/glossarium/0.5.8/themes/default.typ:18:27
│
18 │ #let __glossary_entries = state("__glossary_entries", (:))
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
…Use ast-grep playground (forked version).
First, put the tree-sitter-typst dynamic library beside this README. It will add typst support to ast-grep.
You could do so by any of the following methods:
-
Run
just setupto download it with GitHub CLI. -
Choose the latest run, scroll down to Artifacts, select
*.sofor Linux or*.dllfor Windows, and extract the downloaded zip file. -
(For professionals only) Compile it from https://github.com/uben0/tree-sitter-typst.
You could open that repo with GitHub Codespaces or Gitpod. Please refer to the workflow file for more info.
After that, you can use ast-grep. Please refer to Quick Start | ast-grep for more information.
ast-grep test
# Or just add-test