{"id":17920817,"url":"https://github.com/jeffa5/typstfmt","last_synced_at":"2025-03-24T00:32:33.393Z","repository":{"id":179655166,"uuid":"663686481","full_name":"jeffa5/typstfmt","owner":"jeffa5","description":"A formatter for typst","archived":false,"fork":false,"pushed_at":"2025-01-13T23:14:33.000Z","size":407,"stargazers_count":30,"open_issues_count":7,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-19T01:06:26.550Z","etag":null,"topics":["formatter","rust","typst"],"latest_commit_sha":null,"homepage":"","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jeffa5.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-07T21:56:34.000Z","updated_at":"2025-02-20T16:09:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"7d5a10a4-2243-4589-8411-32ca6c91cbed","html_url":"https://github.com/jeffa5/typstfmt","commit_stats":null,"previous_names":["jeffa5/typstfmt"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffa5%2Ftypstfmt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffa5%2Ftypstfmt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffa5%2Ftypstfmt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffa5%2Ftypstfmt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jeffa5","download_url":"https://codeload.github.com/jeffa5/typstfmt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245191454,"owners_count":20575246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["formatter","rust","typst"],"created_at":"2024-10-28T20:28:58.978Z","updated_at":"2025-03-24T00:32:33.096Z","avatar_url":"https://github.com/jeffa5.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Typst formatter\n\n`typstfmt` is a formatter for [Typst](https://typst.app) code.\n\nIt only formats inputs that are valid Typst code.\nIt aims to make the code consistent.\n\n## Install\n\n### Cargo\n\n```sh\ncargo install --git https://github.com/jeffa5/typstfmt\n```\n\n### Nix\n\nThe flake provides an overlay which you can use with nixpkgs.\n\n### pre-commit\n\nAdd this to your `.pre-commit-config.yaml`:\n\n```yaml\n  - repo: https://github.com/jeffa5/typstfmt\n    rev: ''  # Use the sha / tag you want to point at\n    hooks:\n      - id: typstfmt\n```\n\n## Run\n\n```sh\n# format stdin\ntypstfmt\n# format typst files in current directory\ntypstfmt *.typ\n```\n\n### Nix\n\n```sh\nnix run github:jeffa5/typstfmt\n```\n\n## Configuration\n\nYou can configure some aspects of the formatting with a `typstfmt.toml` file in the current directory, or specify its location with the `--config-path` flag.\n\nThe default configuration is:\n\n```toml\nindent = 2 # spaces\nspacing = true # whether to manage spacing\n```\n\n## Development\n\n### Fuzzing\n\nList some fuzz targets:\n\n```sh\ncargo fuzz list\n```\n\nThen run one, e.g. for `crash_proof`:\n\n```sh\ncargo fuzz run crash_proof\n```\n\n### Testing against the package repo\n\nThe [`typst packages`](https://github.com/typst/packages) repo is a submodule (`typst-packages`).\nWe can run the formatter against it to check the formatting and for erroneous outputs with:\n\n```sh\ncargo run -- typst-packages --check\n```\n\nAnd try to format them all (useful for manual diffing):\n\n```sh\ncargo run -- typst-packages\n```\n\n## Acknowledgements\n\n`typstfmt` is a rewrite of [`typst-fmt`](https://github.com/astrale-sharp/typst-fmt) which aims to retain all original text whilst also be able to be flexible in its configuration.\nI tried writing some rules for that formatter before beginning the redesign present here.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeffa5%2Ftypstfmt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeffa5%2Ftypstfmt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeffa5%2Ftypstfmt/lists"}