{"id":13761168,"url":"https://github.com/BerkeleyTrue/tnskyfmt-fnl","last_synced_at":"2025-05-10T12:31:12.731Z","repository":{"id":66031235,"uuid":"453896041","full_name":"BerkeleyTrue/tnskyfmt-fnl","owner":"BerkeleyTrue","description":"Fennel formatter following [Tonsky's style](https://tonsky.me/blog/clojurefmt/) indenting","archived":false,"fork":false,"pushed_at":"2022-01-31T06:04:20.000Z","size":238,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-03T13:06:09.012Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BerkeleyTrue.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}},"created_at":"2022-01-31T05:58:31.000Z","updated_at":"2024-06-28T15:52:48.000Z","dependencies_parsed_at":"2023-04-04T08:17:27.725Z","dependency_job_id":null,"html_url":"https://github.com/BerkeleyTrue/tnskyfmt-fnl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BerkeleyTrue%2Ftnskyfmt-fnl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BerkeleyTrue%2Ftnskyfmt-fnl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BerkeleyTrue%2Ftnskyfmt-fnl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BerkeleyTrue%2Ftnskyfmt-fnl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BerkeleyTrue","download_url":"https://codeload.github.com/BerkeleyTrue/tnskyfmt-fnl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224958029,"owners_count":17398494,"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":[],"created_at":"2024-08-03T13:01:41.400Z","updated_at":"2024-11-16T18:32:13.500Z","avatar_url":"https://github.com/BerkeleyTrue.png","language":"Lua","funding_links":[],"categories":["Lua"],"sub_categories":[],"readme":"# Fennel Format\n\nFormat your Fennel!\n\n## Usage\n\n    $ make # compile fnlfmt script you can place on your $PATH\n    $ ./fnlfmt mycode.fnl # prints formatted code to standard out\n    $ ./fnlfmt --fix mycode.fnl # replaces the file with formatted code\n    $ curl localhost:8080/my-file.fnl | ./fnlfmt - # pipe to stdin\n\nYou can skip reformatting of top-level forms by placing a comment\nbefore them. This does not work for nested forms.\n\n```fennel\n(fn this-function [can be formatted ...]\n  ...)\n\n;; fnlfmt: skip\n(local this-table [\"benefits\"          :from\n                   \"different kind of\" :FORMATTING\n                   \"because of\"        :reasons])\n\n(fn this-function [will-be]\n  (formatted :normally \"again\"))\n```\n\n## Description\n\nFormatting is essentially an aesthetic process; any automated attempt\nat doing it will necessarily encounter situations where it produces\noutput that doesn't look as good as it would if a human were making\nthe decisions. That said, the goal is to at worst emit output which,\nif less than ideal, is at least not objectionable. Currently the\nindentation decisions it makes are great, but it occasionally puts\nnewlines in places that a human would not.\n\nFor the most part, `fnlfmt` follows established lisp conventions when\ndetermining how to format a given piece of code. Key/value tables are\nshown with each key/value pair on its own line, unless they are small\nenough to all fit on one line. Sequential tables similarly have each\nelement on their own line unless they fit all on a single line. Tables\nwith string keys and symbol values will use `{: foo : bar}` shorthand\nnotation where possible.\n\nCalls are formatted differently depending on whether they are calling\na regular function/macro or whether they're calling a special macro\nwhich is known to have a \"body\"; in the latter case every element is\ngiven its own line, usually indented 2 spaces in.\n\nForms calling `match` and `if` are treated differently; if possible it\nwill attempt to pair off their pattern/condition clauses with the body\non the same line. If that can't fit, it falls back to one-form-per-line.\n\nStrings are formatted using `:colon-notation` where possible, unless\nthey consist entirely of punctuation.\n\nTop level forms may or may not have blank lines between them depending on\nwhether the input code spaces them out. Functions defined inside a\nbody form get empty lines spacing them out as well.\n\nSimilarly `if` forms and arrow forms will occasionally be allowed to\nbe one line if the original code had them as one-liners.\n\n## Known issues\n\n* When using fnlfmt programmatically, it may modify the AST argument.\n* Macros that aren't built-in are always indented like functions.\n* Page breaks will not be preserved.\n\n## Other functionality\n\nThe file `indentation.fnl` contains functionality for implementing\nheuristic-based indentation which does not use a parser. This can be\nuseful for text editors where you want to be able to indent even in\ncases where the code does not parse because it's incomplete.\n\nThe file `macrodebug.fnl` contains a replacement for Fennel's\n`macrodebug` function which pretty-prints the macroexpansion using the\nfull formatter.\n\n## Contributing\n\nSend patches or bug reports directly to the maintainer or the\n[Fennel mailing list](https://lists.sr.ht/%7Etechnomancy/fennel).\n\n## License\n\nCopyright © 2019-2021 Phil Hagelberg and contributors\n\nReleased under the terms of the GNU Lesser General Public License\nversion 3 or later; see the file LICENSE.\n\nFennel is released under the MIT license; see LICENSE.MIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBerkeleyTrue%2Ftnskyfmt-fnl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBerkeleyTrue%2Ftnskyfmt-fnl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBerkeleyTrue%2Ftnskyfmt-fnl/lists"}