Skip to content

YDX-2147483647/ast-grep-typst

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Typst rules based on ast-grep

Check

Usage

$ 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", (:))
   │                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

…

Development

Online

Use ast-grep playground (forked version).

Local

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 setup to download it with GitHub CLI.

  • Manually download it from Build tree-sitter-typst.

    Choose the latest run, scroll down to Artifacts, select *.so for Linux or *.dll for 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

About

Typst rules based on ast-grep

Topics

Resources

Stars

Watchers

Forks

Languages