{"id":13683036,"url":"https://github.com/lukas-reineke/cbfmt","last_synced_at":"2025-04-06T18:16:35.967Z","repository":{"id":50297019,"uuid":"515855451","full_name":"lukas-reineke/cbfmt","owner":"lukas-reineke","description":"A tool to format codeblocks inside markdown and org documents.","archived":false,"fork":false,"pushed_at":"2023-03-01T14:59:57.000Z","size":43,"stargazers_count":158,"open_issues_count":10,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-02T02:21:17.637Z","etag":null,"topics":["codeblocks","command-line-tool","formatter","markdown","org-mode","restructuredtext","rust"],"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/lukas-reineke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":["lukas-reineke"]}},"created_at":"2022-07-20T06:09:04.000Z","updated_at":"2024-05-02T02:21:17.637Z","dependencies_parsed_at":"2024-01-14T15:25:18.127Z","dependency_job_id":"a948e33d-c12f-4293-829b-df29d712bb8a","html_url":"https://github.com/lukas-reineke/cbfmt","commit_stats":{"total_commits":15,"total_committers":3,"mean_commits":5.0,"dds":0.2666666666666667,"last_synced_commit":"88a3e46fb15ca855b12bd55712d3641a63aab917"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukas-reineke%2Fcbfmt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukas-reineke%2Fcbfmt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukas-reineke%2Fcbfmt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukas-reineke%2Fcbfmt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukas-reineke","download_url":"https://codeload.github.com/lukas-reineke/cbfmt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247526764,"owners_count":20953143,"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":["codeblocks","command-line-tool","formatter","markdown","org-mode","restructuredtext","rust"],"created_at":"2024-08-02T13:01:58.213Z","updated_at":"2025-04-06T18:16:35.932Z","avatar_url":"https://github.com/lukas-reineke.png","language":"Rust","funding_links":["https://github.com/sponsors/lukas-reineke"],"categories":["Rust"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg height=\"400\" src=\"https://user-images.githubusercontent.com/12900252/188409065-2149a392-e5cb-4486-8d2b-b80f9022ef4c.png\" alt=\"cbfmt\" /\u003e\n\u003c/p\u003e\n\n# cbfmt (codeblock format)\n\nA tool to format codeblocks inside markdown, org, and restructuredtext documents.  \nIt iterates over all codeblocks, and formats them with the tool(s) specified for\nthe language of the block.\n\n## Install\n\n### Download from GitHub\n\nDownload the latest release binaries from [github.com/lukas-reineke/cbfmt/releases](https://github.com/lukas-reineke/cbfmt/releases)\n\n### Cargo\n\n```bash\ncargo install cbfmt\n```\n\n### Build from source\n\n1. Clone this repository\n2. Build with [cargo](https://github.com/rust-lang/cargo/)\n\n```bash\ngit clone https://github.com/lukas-reineke/cbfmt.git \u0026\u0026 cd cbfmt\ncargo install --path .\n```\n\nThis will install `cbfmt` in your `~/.cargo/bin`. Make sure to add `~/.cargo/bin` directory to your `PATH` variable.\n\n## Config\n\nA configuration file is required. By default the file is called\n`.cbfmt.toml`\n\nExample:\n\n```toml\n[languages]\nrust = [\"rustfmt\"]\ngo = [\"gofmt\"]\nlua = [\"stylua -s -\"]\npython = [\"black --fast -\"]\n```\n\n### Sections\n\n#### languages\n\nThis section specifies which commands should run for which language.  \nEach entry is the name of the language as the key, and a list of format commands\nto run in sequence as the value. Each format command needs to read from stdin\nand write to stdout.\n\n## Usage\n\n### With arguments\n\nYou can run `cbfmt` on files and or directories by passing them as\narguments.\n\n```bash\ncbfmt [OPTIONS] [file/dir/glob]...\n```\n\nThe default behaviour checks formatting for all files that were passed as\narguments. If all files are formatted correctly, it exits with status code 0,\notherwise it exits with status code 1.\n\nWhen a directory is passed as an argument, `cbfmt` will recursively run on all files\nin that directory which have a valid parser and are not ignored by git.\n\n### With stdin\n\nIf no arguments are specified, `cbfmt` will read from stdin and write the format\nresult to stdout.\n\n```bash\ncbfmt [OPTIONS] \u003c [file]\n```\n\n### Without arguments and stdin\n\nIf there are no arguments and nothing is written to stdin, `cbfmt` will print\nthe help text and exit.\n\n### Options\n\nThese are the most important options. To see all options, please run\n`cbfmt --help`\n\n#### check `-c|--check`\n\nWorks the same as the default behaviour, but only prints the path to files that\nfail.\n\n#### write `-w|--write`\n\nWrites the format result back into the files.\n\n#### parser `-p|--parser`\n\nSpecifies which parser to use. This is inferred from the file ending when\npossible.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukas-reineke%2Fcbfmt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukas-reineke%2Fcbfmt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukas-reineke%2Fcbfmt/lists"}