{"id":13995102,"url":"https://github.com/antonWetzel/prettypst","last_synced_at":"2025-07-22T21:31:58.978Z","repository":{"id":208457222,"uuid":"721681743","full_name":"antonWetzel/prettypst","owner":"antonWetzel","description":"Formatter for Typst","archived":false,"fork":false,"pushed_at":"2024-07-29T11:02:39.000Z","size":363,"stargazers_count":24,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-10T14:18:22.167Z","etag":null,"topics":["formatter","typst"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/antonWetzel.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","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-11-21T14:59:25.000Z","updated_at":"2024-07-29T11:02:42.000Z","dependencies_parsed_at":"2024-04-23T15:46:30.284Z","dependency_job_id":"a82f9910-2e0a-43c4-887b-ed60ee3b2cc4","html_url":"https://github.com/antonWetzel/prettypst","commit_stats":null,"previous_names":["antonwetzel/prettypst"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonWetzel%2Fprettypst","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonWetzel%2Fprettypst/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonWetzel%2Fprettypst/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonWetzel%2Fprettypst/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antonWetzel","download_url":"https://codeload.github.com/antonWetzel/prettypst/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227177766,"owners_count":17743163,"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","typst"],"created_at":"2024-08-09T14:03:15.075Z","updated_at":"2025-07-22T21:31:58.963Z","avatar_url":"https://github.com/antonWetzel.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# Prettypst\n\n\n## Formatter for Typst!\n\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd\u003e Before \u003c/td\u003e \u003ctd\u003e Default Style \u003c/td\u003e \u003ctd\u003e OTBS Style \u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e \n\n```typst\n= Heading\n== Table or Grid\n#table(\n    columns: (1fr, 1fr),\n    align: (left, right),\n    [a], [b],\n    [longer], [],\n    [c],\n    [test],\n)\n== Equation\n  $ x \u0026 = 13 y \u0026 \\\n  \u0026 \u0026 z? \\\n  2 y \u0026 = 13 * 2 y \\\n  \\\n  \u0026 \\\n$\n\nSome math $c$, $d $, $ e$ and $ f_1^       pi * - 3$.\n== Trailing comma and long blocks\n\n// no trailing comma and content with only spaces\n#figure(\n    caption: [compact],\n    [ Some Content ]\n)\n\n// no trailing comma and content with newline\n#figure(\n    caption: [nested],\n    [\n            Some Content ]\n)\n\n// trailing comma and content with newline\n#figure(\n    caption: [nested],\n    [\n            Some Content ],\n)\n\n== Linebreaks\n\nEverything is written in content\nmode is on the same line after formatting.\nMaybe wanted or unwanted.\n#image(\"image_a.png\")\n#image(\"image_b.png\")\n\nBut paragraphs stay seperated!\n\n== Label\u003csection_label\u003e\n\n== Nesting\n\n#let f = (diff, content ) =\u003e {\n\nbox(width: 30%,align(center,{\n    content\n    v(diff, weak:true)\n    counter.display(numbering) + [ ] + caption\n}))\n}\n\n== Code\n\n#{\n    let    x= 1 * - 3 ;\n    let y=    1==2 and 3==3 \n}\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n```typst\n= Heading\n\n== Table or Grid\n#table(\n  columns: (1fr, 1fr),\n  align: (left, right),\n  [a],      [b],\n  [longer], [],\n  [c],      [test],\n)\n\n== Equation\n$ x   \u0026 = 13 y     \u0026    \\\n      \u0026            \u0026 z? \\\n  2 y \u0026 = 13 * 2 y      \\\n                        \\\n      \u0026                 \\ $\n\nSome math $c$, $d$, $e$ and $f_1^pi * - 3$.\n\n== Trailing comma and long blocks\n\n// no trailing comma and content with only spaces\n#figure(caption: [compact], [ Some Content ])\n\n// no trailing comma and content with newline\n#figure(caption: [nested], [\n  Some Content ])\n\n// trailing comma and content with newline\n#figure(\n  caption: [nested],\n  [\n    Some Content ],\n)\n\n== Linebreaks\n\nEverything is written in content\nmode is on the same line after formatting.\nMaybe wanted or unwanted.\n#image(\"image_a.png\")\n#image(\"image_b.png\")\n\nBut paragraphs stay seperated!\n\n== Label \u003csection_label\u003e\n\n== Nesting\n\n#let f = (diff, content) =\u003e {\n\n  box(width: 30%, align(center, {\n    content\n    v(diff, weak: true)\n    counter.display(numbering) + [ ] + caption\n  }))\n}\n\n== Code\n\n#{\n  let x = 1 * -3;\n  let y = 1 == 2 and 3 == 3\n}\n```\n\n\u003c/td\u003e\n\u003ctd\u003e \n\n```typst\n= Heading\n\n\n== Table or Grid\n\n#table(\n\tcolumns: (1fr, 1fr),\n\talign: (left, right),\n\t[a],      [b],\n\t[longer], [],\n\t[c],      [test],\n)\n\n\n== Equation\n\n$\n\tx   \u0026 = 13 y     \u0026    \\\n\t    \u0026            \u0026 z? \\\n\t2 y \u0026 = 13 * 2 y      \\\n\t                      \\\n\t    \u0026                 \\\n$\n\nSome math $c$, $d$, $e$ and $f_1^pi * - 3$.\n\n\n== Trailing comma and long blocks\n\n// no trailing comma and content with only spaces\n#figure(caption: [compact], [ Some Content ])\n\n// no trailing comma and content with newline\n#figure(caption: [nested], [\n\tSome Content\n])\n\n// trailing comma and content with newline\n#figure(\n\tcaption: [nested],\n\t[\n\t\tSome Content\n\t],\n)\n\n\n== Linebreaks\n\nEverything is written in content mode is on the same line after formatting. Maybe wanted or unwanted. #image(\"image_a.png\") #image(\"image_b.png\")\n\nBut paragraphs stay seperated!\n\n\n== Label \u003csection_label\u003e\n\n\n== Nesting\n\n#let f = (diff, content) =\u003e {\n\n\tbox(width: 30%, align(center, {\n\t\tcontent\n\t\tv(diff, weak: true)\n\t\tcounter.display(numbering) + [ ] + caption\n\t}))\n}\n\n\n== Code\n\n#{\n\tlet x = 1 * -3;\n\tlet y = 1 == 2 and 3 == 3\n}\n```\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n\n## Install\n\n\tcargo install --git=https://github.com/antonWetzel/prettypst.git --locked\n\n## Usage / Features\n\n- Prettypst might change your work, use only if you can recover a previous version.\n- Insert or remove trailing comma to change between single line and multiline\n- Any feature requests are welcome\n\n### Terminal\n\n\tprettypst [--help]                          | Print help\n\tprettypst \u003cfile\u003e                            | Format file inplace\n\tprettypst --use-std-in ...                  | Use terminal as input\n\tprettypst ... -o \u003coutput-file\u003e              | Change output file\n\tprettypst ... --use-std-out                 | Use terminal as output\n\tprettypst --style=[default | otbs] ...      | Change the used style\n\tprettypst --use-configuration ...           | Load a configuration from \"prettypst.toml\"\n\tprettypst --file-location=\u003cpath\u003e ...        | Change file location to search for configuration (use with --use-std-in)\n\n### VSCodium or VSCode\n\n- install custom-local-formatters\n- use prettypst for typst\n\t- ```json\n\t\t\"customLocalFormatters.formatters\": [\n\t\t\t{\n\t\t\t\t\"command\": \"prettypst --use-std-in --use-std-out --file-location=${file}\",\n\t\t\t\t\"languages\": [\n\t\t\t\t\t\"typst\",\n\t\t\t\t],\n\t\t\t}\n\t\t],\n   \t\t```\n- change command to use wanted style or configuration\n\t- `--style=otbs`\n\t- `--use-configuration`\n\t\t- `prettypst.toml` must be in the same folder as the formatted file or a parent folder\n\n### Helix\n\n- Add `prettypst` to your `languages.toml`\n- ```toml\n  [[language]]\n  name = \"typst\"\n  # ...\n  formatter = { command = \"prettypst\", args = [\"--use-std-in\", \"--use-std-out\"] }\n  ```\n- change command to use wanted style or configuration\n\t- `--style=otbs`\n\t- `--use-configuration`\n\t\t- `prettypst.toml` must be in the current working directory or a parent folder\n\n## Settings\n\n- create configuration with `prettypst [--style=otbs] --save-configuration`\n\n```gdscript\nindentation = 0 | 1 | ... # use 0 for tabs\nseparate-label = false | true # insert space before a label\nfinal-newline = false | true # insert a final newline at the end\n\n[preserve-newline]\ncontent = false | true # preserve single newlines in markup\nmath = false | true # preserve single newline in equations\n\n[automatic-newline]\nmax-width = 0 # insert a linebreak if the current line would exceed the max width, use zero to disable \nin-strong = false # allow automatic linebreak in strong (*...*)\nin-emphasis = false # allow automatic linebreak in emphasis (_..._)\n\n[block]\nlong-block-style = \"separate\" | \"compact\" # '[' and ']' on the same or separate lines as the content\n\n[term]\nspace-before = false | true # insert a space before the ':' in terms\nspace-after = false | true # insert a space after the ':' in terms\n\n[named-argument]\nspace-before = false | true # insert a space before the ':' in named arguments\nspace-after = false | true # insert a space after the ':' in named arguments\n\n[dictionary-entry]\nspace-before = false | true # insert a space before the ':' in dictionary entries\nspace-after = false | true # insert a space after the ':' in dictionary entries\n\n[import-statement]\nspace-before = false | true # insert a space before the ':' in import statements\nspace-after = false | true # insert a space after the ':' in import statements\n\n[comma]\nspace-before = false | true # insert a space before the ',' in arguments\nspace-after = false | true # insert a space after the ',' in arguments\n\n\n[columns]\ncomma = \"end-of-content\" | \"end-of-cell\" # how to align commas in tables\n\n[heading]\nblank-lines-before = 0 | 1 | ... # blank lines before a heading\nblank-lines-after = 0 | 1 | ... # blank lines after a heading\n\n[columns-commands]\ngrid = \"columns\"     # format the \"grid\", \"gridx\", ... command with\ngridx = \"columns\"    # columns specified by the named argument \"columns\"\ntable = \"columns\"\ntablex = \"columns\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FantonWetzel%2Fprettypst","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FantonWetzel%2Fprettypst","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FantonWetzel%2Fprettypst/lists"}