{"id":20425944,"url":"https://github.com/typedduck/docfmt","last_synced_at":"2026-05-09T18:36:27.173Z","repository":{"id":205311278,"uuid":"713934729","full_name":"typedduck/docfmt","owner":"typedduck","description":"A document-formatter using Handlebars templates","archived":false,"fork":false,"pushed_at":"2024-04-04T14:03:33.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-05T05:16:46.285Z","etag":null,"topics":["command-line-tool","document-formatter","handlebars","templates","text-processing"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/typedduck.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","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}},"created_at":"2023-11-03T14:49:43.000Z","updated_at":"2023-11-27T10:35:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"934d8114-094e-4865-8757-28246e510813","html_url":"https://github.com/typedduck/docfmt","commit_stats":null,"previous_names":["typedduck/docfmt"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/typedduck/docfmt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typedduck%2Fdocfmt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typedduck%2Fdocfmt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typedduck%2Fdocfmt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typedduck%2Fdocfmt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/typedduck","download_url":"https://codeload.github.com/typedduck/docfmt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typedduck%2Fdocfmt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32831272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["command-line-tool","document-formatter","handlebars","templates","text-processing"],"created_at":"2024-11-15T07:14:46.872Z","updated_at":"2026-05-09T18:36:27.055Z","avatar_url":"https://github.com/typedduck.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Document Formatter\n\n![Build Status](https://img.shields.io/github/actions/workflow/status/typedduck/docfmt/rust.yml)\n[![Crates.io](https://img.shields.io/crates/v/docfmt)](https://crates.io/crates/docfmt)\n[![Crates.io](https://img.shields.io/crates/d/docfmt)](https://crates.io/crates/docfmt)\n\nThis is a tool to format documents using a template and data. Multiple data files can be merged. Paths and files can be included and referenced in the template.\n\nThe data and input files are passed to the template engine [Handlebars](https://handlebarsjs.com/).\n\n## Template\n\nThe template file may be in any format supported by [Handlebars](https://handlebarsjs.com/). The implementation used is [handlebars-rust](https://docs.rs/handlebars/latest/handlebars/). The feature `rust-embed` is not enabled.\n\nHandlebars is a versatile template engine. It supports a wide range of features. The documentation for Handlebars is extensive and can be found [here](https://handlebarsjs.com/guide/).\n\n## Usage\n\n```bash\ndocfmt [OPTIONS] \u003cTEMPLATE\u003e \u003cOUTPUT\u003e\n```\n\n## Options\n\n### `-c`, `--config`\n\nPath to a TOML file containing the configuration. The configuration file can be used to define the template, output, data, and includes. The command line arguments take precedence over the configuration file.\n\n### `-i`, `--include`\n\nPath or file to include in the document. Can be used multiple times. Directories are traversed recursively. Files and directories are stripped from the path and the file extension. Dotfiles are ignored when traversing directories. The files are included in the order they are defined.\n\nOn Windows, the stripped path naming the template are converted to use forward slashes as well.\n\n### `-e`, `--ext`\n\nComma-separated list of file extensions to include in directories. Defaults to `md,markdown`.\n\n### `-d`, `--data`\n\nPath or file to include in the document. Can be used multiple times. Directories are traversed recursively. Data may be defined in JSON or TOML format. The type is determined by the file extension. If defined multiple times, the data is merged. Merging is done in the sequence the files are defined. The last file takes precedence over the previous ones.\n\n### `-f`, `--force`\n\nOverwrite the output file if it already exists.\n\n### `-v`, `--verbose`\n\nEnable verbose logging. If defined the log level is set to `debug` if the program is compiled in debug mode, otherwise it is set to `info`. If not defined the log level is set to `warn`. The log is written to stderr.\n\n### `-s`, `--strict`\n\nRestrict accessing non-existing fields or indices in templates. If defined the program will exit with an error if a field or index is accessed that does not exist. If not defined the program will ignore such accesses.\n\n### `--follow`\n\nFollow symbolic links when traversing directories. This option is only available on Unix systems.\n\n### `-V`, `--version`\n\nPrint version information.\n\n### `-h`, `--help`\n\nPrint help information.\n\n## Arguments\n\n### `\u003cTEMPLATE\u003e`\n\nPath to the template file. The template file may be in any format supported by [Handlebars](https://handlebarsjs.com/). The template file may be omitted if the template is defined in the configuration file.\n\n### `\u003cOUTPUT\u003e`\n\nPath to the output file. The output file may be omitted if the output is defined in the configuration file.\n\n## Configuration\n\nThe configuration file is a TOML file. The following keys are supported:\n\n```toml\ntemplate = \"\u003cpath to template\u003e\"\noutput = \"\u003cpath to output\u003e\"\nforce = false\nfollow = false\nverbose = false\nstrict = false\ninclude = [\"\u003cfile to include\u003e\", \"\u003cpath to include\u003e\"]\next = [\"md\", \"markdown\"]\ndatafiles = [\"\u003cpath to json-file\u003e\", \"\u003cpath to toml-file\u003e\"]\n\n[data]\ntitle = \"My title\"\n```\n\nThe `template` and `output` keys are required. The `force`, `follow`, `verbose`, and `strict` keys are optional and default to `false`. The `include` and `ext` keys are optional and default to `[]` and `[\"md\", \"markdown\"]` respectively. The `datafiles` key is optional and defaults to `[]`. The `data` key is optional and defaults to `{}`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypedduck%2Fdocfmt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftypedduck%2Fdocfmt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypedduck%2Fdocfmt/lists"}