{"id":13534573,"url":"https://github.com/gajus/gitdown","last_synced_at":"2025-09-20T22:31:51.645Z","repository":{"id":22532931,"uuid":"25873603","full_name":"gajus/gitdown","owner":"gajus","description":"GitHub markdown preprocessor.","archived":false,"fork":false,"pushed_at":"2024-07-19T15:18:01.000Z","size":429,"stargazers_count":452,"open_issues_count":20,"forks_count":53,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-12-31T13:11:35.577Z","etag":null,"topics":["markdown"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gajus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"gajus","patreon":"gajus"}},"created_at":"2014-10-28T14:35:12.000Z","updated_at":"2024-08-20T12:20:51.000Z","dependencies_parsed_at":"2024-06-18T13:52:42.654Z","dependency_job_id":"6df99941-2369-40e2-a5d7-c3d842ffaaf9","html_url":"https://github.com/gajus/gitdown","commit_stats":{"total_commits":418,"total_committers":10,"mean_commits":41.8,"dds":"0.36602870813397126","last_synced_commit":"a323123bc1d8c8bb9f8c516406aefe5ddca80ff4"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gajus%2Fgitdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gajus%2Fgitdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gajus%2Fgitdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gajus%2Fgitdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gajus","download_url":"https://codeload.github.com/gajus/gitdown/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233690484,"owners_count":18714782,"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":["markdown"],"created_at":"2024-08-01T08:00:27.973Z","updated_at":"2025-09-20T22:31:46.340Z","avatar_url":"https://github.com/gajus.png","language":"JavaScript","funding_links":["https://github.com/sponsors/gajus","https://patreon.com/gajus"],"categories":["The list","Tools","JavaScript","markdown"],"sub_categories":["Miscellaneous"],"readme":"[![GitSpo Mentions](https://gitspo.com/badges/mentions/gajus/gitdown?style=flat-square)](https://gitspo.com/mentions/gajus/gitdown)\n[![NPM version](http://img.shields.io/npm/v/gitdown.svg?style=flat-square)](https://www.npmjs.org/package/gitdown)\n[![Travis build status](http://img.shields.io/travis/brettz9/gitdown/update-readme.svg?style=flat-square)](https://travis-ci.org/brettz9/gitdown)\n[![Dependency Status](https://img.shields.io/david/brettz9/gitdown.svg?style=flat-square)](https://david-dm.org/brettz9/gitdown)\n\nGitdown adds [additional functionality](#user-content-features) (generating table of contents, including documents, using variables, etc.) to [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown/).\n\n\u003ca name=\"user-content-cheat-sheet\"\u003e\u003c/a\u003e\n\u003ca name=\"cheat-sheet\"\u003e\u003c/a\u003e\n## Cheat Sheet\n\n\n```js\n// Generate table of contents\n{\"gitdown\": \"contents\"}\n{\"gitdown\": \"contents\", \"maxLevel\": 4}\n{\"gitdown\": \"contents\", \"rootId\": \"features\"}\n\n// Use a custom defined variable\n{\"gitdown\": \"variable\", \"name\": \"nameOfTheVariable\"}\n\n// Include file\n{\"gitdown\": \"include\", \"file\": \"./LICENSE.md\"}\n\n// Get file size\n{\"gitdown\": \"filesize\", \"file\": \"./src/gitdown.js\"}\n{\"gitdown\": \"filesize\", \"file\": \"./src/gitdown.js\", \"gzip\": true}\n\n// Generate badges\n{\"gitdown\": \"badge\", \"name\": \"npm-version\"}\n{\"gitdown\": \"badge\", \"name\": \"bower-version\"}\n{\"gitdown\": \"badge\", \"name\": \"travis\"}\n{\"gitdown\": \"badge\", \"name\": \"david\"}\n{\"gitdown\": \"badge\", \"name\": \"david-dev\"}\n{\"gitdown\": \"badge\", \"name\": \"waffle\"}\n\n// Print date\n{\"gitdown\": \"date\", \"format\": \"YYYY\"}\n\n```\n\n\n\u003ca name=\"user-content-contents\"\u003e\u003c/a\u003e\n\u003ca name=\"contents\"\u003e\u003c/a\u003e\n## Contents\n\n* [Cheat Sheet](#user-content-cheat-sheet)\n* [Contents](#user-content-contents)\n* [Command Line Usage](#user-content-command-line-usage)\n* [API Usage](#user-content-api-usage)\n    * [Logging](#user-content-api-usage-logging)\n* [Syntax](#user-content-syntax)\n    * [Ignoring Sections of the Document](#user-content-syntax-ignoring-sections-of-the-document)\n    * [Register a Custom Helper](#user-content-syntax-register-a-custom-helper)\n* [Features](#user-content-features)\n    * [Generate Table of Contents](#user-content-features-generate-table-of-contents)\n    * [Heading Nesting](#user-content-features-heading-nesting)\n    * [Find Dead URLs and Fragment Identifiers](#user-content-features-find-dead-urls-and-fragment-identifiers)\n    * [Reference an Anchor in the Repository](#user-content-features-reference-an-anchor-in-the-repository)\n    * [Variables](#user-content-features-variables)\n    * [Include File](#user-content-features-include-file)\n    * [Get File Size](#user-content-features-get-file-size)\n    * [Generate Badges](#user-content-features-generate-badges)\n    * [Print Date](#user-content-features-print-date)\n    * [Gitinfo](#user-content-features-gitinfo)\n* [Recipes](#user-content-recipes)\n    * [Automating Gitdown](#user-content-recipes-automating-gitdown)\n\n\n\u003ca name=\"user-content-command-line-usage\"\u003e\u003c/a\u003e\n\u003ca name=\"command-line-usage\"\u003e\u003c/a\u003e\n## Command Line Usage\n\n```sh\nnpm install gitdown -g\ngitdown ./.README/README.md --output-file ./README.md\n\n```\n\n\u003ca name=\"user-content-api-usage\"\u003e\u003c/a\u003e\n\u003ca name=\"api-usage\"\u003e\u003c/a\u003e\n## API Usage\n\n```js\nimport Gitdown from 'gitdown';\n\n// Read the markdown file written using the Gitdown extended markdown.\n// File name is not important.\n// Having all of the Gitdown markdown files under ./.README/ path is the recommended convention.\nconst gitdown = await Gitdown.readFile('./.README/README.md');\n\n// If you have the subject in a string, call the constructor itself:\n// gitdown = await Gitdown.read('literal string');\n\n// Get config.\ngitdown.getConfig()\n\n// Set config.\ngitdown.setConfig({\n  gitinfo: {\n    gitPath: __dirname\n  }\n})\n\n// Output the markdown file.\n// All of the file system operations are relative to the root of the repository.\ngitdown.writeFile('README.md');\n```\n\n\u003ca name=\"user-content-api-usage-logging\"\u003e\u003c/a\u003e\n\u003ca name=\"api-usage-logging\"\u003e\u003c/a\u003e\n### Logging\n\nGitdown is using `console` object to log messages. You can set your own logger:\n\n```js\ngitdown.setLogger({\n  info: () =\u003e {},\n  warn: () =\u003e {}\n});\n\n```\n\nThe logger is used to inform about [Dead URLs and Fragment Identifiers](#user-content-find-dead-urls-and-fragment-identifiers).\n\n\u003ca name=\"user-content-syntax\"\u003e\u003c/a\u003e\n\u003ca name=\"syntax\"\u003e\u003c/a\u003e\n## Syntax\n\nGitdown extends markdown syntax using JSON:\n\n\n```json\n{\"gitdown\": \"helper name\", \"parameter name\": \"parameter value\"}\n\n```\n\n\nThe JSON object must have a `gitdown` property that identifies the helper you intend to execute. The rest is a regular JSON string, where each property is a named configuration property of the helper that you are referring to.\n\nJSON that does not start with a \"gitdown\" property will remain untouched.\n\n\u003ca name=\"user-content-syntax-ignoring-sections-of-the-document\"\u003e\u003c/a\u003e\n\u003ca name=\"syntax-ignoring-sections-of-the-document\"\u003e\u003c/a\u003e\n### Ignoring Sections of the Document\n\nUse HTML comment tags to ignore sections of the document:\n\n```html\nGitdown JSON will be interpolated.\n\u0026lt;!-- gitdown: off --\u0026gt;\nGitdown JSON will not be interpolated.\n\u0026lt;!-- gitdown: on --\u0026gt;\nGitdown JSON will be interpolated.\n\n```\n\n\u003ca name=\"user-content-syntax-register-a-custom-helper\"\u003e\u003c/a\u003e\n\u003ca name=\"syntax-register-a-custom-helper\"\u003e\u003c/a\u003e\n### Register a Custom Helper\n\n```js\ngitdown.registerHelper('my-helper-name', {\n  /**\n    * @var {Number} Weight determines the processing order of the helper function. Default: 10.\n    */\n  weight: 10,\n  /**\n    * @param {Object} config JSON configuration.\n    * @return {mixed|Promise}\n    */\n  compile: (config) =\u003e {\n      return 'foo: ' + config.foo;\n  }\n});\n```\n\n\n```json\n{\"gitdown\": \"my-helper-name\", \"foo\": \"bar\"}\n\n```\n\n\nProduces:\n\n```markdown\nfoo: bar\n\n```\n\n\na\n\n\u003ca name=\"user-content-features\"\u003e\u003c/a\u003e\n\u003ca name=\"features\"\u003e\u003c/a\u003e\n## Features\n\n\u003ca name=\"user-content-features-generate-table-of-contents\"\u003e\u003c/a\u003e\n\u003ca name=\"features-generate-table-of-contents\"\u003e\u003c/a\u003e\n### Generate Table of Contents\n\n\n```json\n{\"gitdown\": \"contents\"}\n\n```\n\n\nGenerates table of contents.\n\nThe table of contents is generated using [markdown-contents](https://github.com/gajus/markdown-contents).\n\n\u003ca name=\"user-content-features-generate-table-of-contents-example\"\u003e\u003c/a\u003e\n\u003ca name=\"features-generate-table-of-contents-example\"\u003e\u003c/a\u003e\n#### Example\n\n\n```json\n{\"gitdown\": \"contents\", \"maxLevel\": 4, \"rootId\": \"features\"}\n\n```\n\n\n```markdown\n* [Generate Table of Contents](#user-content-features-generate-table-of-contents)\n    * [Example](#user-content-features-generate-table-of-contents-example)\n    * [JSON Configuration](#user-content-features-generate-table-of-contents-json-configuration)\n* [Heading Nesting](#user-content-features-heading-nesting)\n    * [Parser Configuration](#user-content-features-heading-nesting-parser-configuration)\n* [Find Dead URLs and Fragment Identifiers](#user-content-features-find-dead-urls-and-fragment-identifiers)\n    * [Parser Configuration](#user-content-features-find-dead-urls-and-fragment-identifiers-parser-configuration-1)\n* [Reference an Anchor in the Repository](#user-content-features-reference-an-anchor-in-the-repository)\n    * [JSON Configuration](#user-content-features-reference-an-anchor-in-the-repository-json-configuration-1)\n    * [Parser Configuration](#user-content-features-reference-an-anchor-in-the-repository-parser-configuration-2)\n* [Variables](#user-content-features-variables)\n    * [Example](#user-content-features-variables-example-1)\n    * [JSON Configuration](#user-content-features-variables-json-configuration-2)\n    * [Parser Configuration](#user-content-features-variables-parser-configuration-3)\n* [Include File](#user-content-features-include-file)\n    * [Example](#user-content-features-include-file-example-2)\n    * [JSON Configuration](#user-content-features-include-file-json-configuration-3)\n* [Get File Size](#user-content-features-get-file-size)\n    * [Example](#user-content-features-get-file-size-example-3)\n    * [JSON Configuration](#user-content-features-get-file-size-json-configuration-4)\n* [Generate Badges](#user-content-features-generate-badges)\n    * [Supported Services](#user-content-features-generate-badges-supported-services)\n    * [Example](#user-content-features-generate-badges-example-4)\n    * [JSON Configuration](#user-content-features-generate-badges-json-configuration-5)\n* [Print Date](#user-content-features-print-date)\n    * [Example](#user-content-features-print-date-example-5)\n    * [JSON Configuration](#user-content-features-print-date-json-configuration-6)\n* [Gitinfo](#user-content-features-gitinfo)\n    * [Example](#user-content-features-gitinfo-example-6)\n    * [Supported Properties](#user-content-features-gitinfo-supported-properties)\n    * [JSON Configuration](#user-content-features-gitinfo-json-configuration-7)\n    * [Parser Configuration](#user-content-features-gitinfo-parser-configuration-4)\n\n\n```\n\n\u003ca name=\"user-content-features-generate-table-of-contents-json-configuration\"\u003e\u003c/a\u003e\n\u003ca name=\"features-generate-table-of-contents-json-configuration\"\u003e\u003c/a\u003e\n#### JSON Configuration\n\n| Name | Description | Default |\n| --- | --- | --- |\n| `maxLevel` | The maximum heading level after which headings are excluded. | 3 |\n| `rootId` | ID of the root heading. Provide it when you need table of contents for a specific section of the document. Throws an error if element with the said ID does not exist in the document. | N/A |\n\n\u003ca name=\"user-content-features-heading-nesting\"\u003e\u003c/a\u003e\n\u003ca name=\"features-heading-nesting\"\u003e\u003c/a\u003e\n### Heading Nesting\n\nGithub markdown processor generates heading ID based on the text of the heading.\n\nThe conflicting IDs are solved with a numerical suffix, e.g.\n\n```markdown\n# Foo\n## Something\n# Bar\n## Something\n\n```\n\n```html\n\u003ch1 id=\"foo\"\u003eFoo\u003c/h1\u003e\n\u003ch2 id=\"something\"\u003eSomething\u003c/h1\u003e\n\u003ch1 id=\"bar\"\u003eBar\u003c/h1\u003e\n\u003ch2 id=\"something-1\"\u003eSomething\u003c/h1\u003e\n\n```\n\nThe problem with this approach is that it makes the order of the content important.\n\nGitdown will nest the headings using parent heading names to ensure uniqueness, e.g.\n\n```markdown\n# Foo\n## Something\n# Bar\n## Something\n\n```\n\n```html\n\u003ch1 id=\"foo\"\u003eFoo\u003c/h1\u003e\n\u003ch2 id=\"foo-something\"\u003eSomething\u003c/h1\u003e\n\u003ch1 id=\"bar\"\u003eBar\u003c/h1\u003e\n\u003ch2 id=\"bar-something\"\u003eSomething\u003c/h1\u003e\n\n```\n\n\u003ca name=\"user-content-features-heading-nesting-parser-configuration\"\u003e\u003c/a\u003e\n\u003ca name=\"features-heading-nesting-parser-configuration\"\u003e\u003c/a\u003e\n#### Parser Configuration\n\n| Name | Description | Default |\n| --- | --- | --- |\n| `headingNesting.enabled` | Boolean flag indicating whether to nest headings. | `true` |\n\n\u003ca name=\"user-content-features-find-dead-urls-and-fragment-identifiers\"\u003e\u003c/a\u003e\n\u003ca name=\"features-find-dead-urls-and-fragment-identifiers\"\u003e\u003c/a\u003e\n### Find Dead URLs and Fragment Identifiers\n\nUses [Deadlink](https://github.com/gajus/deadlink) to iterate through all of the URLs in the resulting document. Throws an error if either of the URLs is resolved with an HTTP status other than 200 or fragment identifier (anchor) is not found.\n\n\u003ca name=\"user-content-features-find-dead-urls-and-fragment-identifiers-parser-configuration-1\"\u003e\u003c/a\u003e\n\u003ca name=\"features-find-dead-urls-and-fragment-identifiers-parser-configuration-1\"\u003e\u003c/a\u003e\n#### Parser Configuration\n\n| Name | Description | Default |\n| --- | --- | --- |\n| `deadlink.findDeadURLs` | Find dead URLs. | `false` |\n| `deadlink.findDeadFragmentIdentifiers` | Find dead fragment identifiers. | `false` |\n\n\u003c!-- --\u003e\n\u003c!--| `deadlink.ignoreURLs` | URLs matching the regex will be ignored. | N/A |--\u003e\n\n\u003ca name=\"user-content-features-reference-an-anchor-in-the-repository\"\u003e\u003c/a\u003e\n\u003ca name=\"features-reference-an-anchor-in-the-repository\"\u003e\u003c/a\u003e\n### Reference an Anchor in the Repository\n\n\u003e This feature is under development.\n\u003e Please suggest ideas https://github.com/gajus/gitdown/issues\n\n\n```json\n{\"gitdown\": \"anchor\"}\n\n```\n\n\nGenerates a Github URL to the line in the source code with the anchor documentation tag of the same name.\n\nPlace a documentation tag `@gitdownanchor \u003cname\u003e` anywhere in the code base, e.g.\n\n```js\n/**\n * @gitdownanchor my-anchor-name\n */\n\n```\n\nThen reference the tag in the Gitdown document:\n\n\n```\nRefer to [foo]({\"gitdown\": \"anchor\", \"name\": \"my-anchor-name\"}).\n\n```\n\n\nThe anchor name must match `/^[a-z]+[a-z0-9\\-_:\\.]*$/i`.\n\nGitdown will throw an error if the anchor is not found.\n\n\u003ca name=\"user-content-features-reference-an-anchor-in-the-repository-json-configuration-1\"\u003e\u003c/a\u003e\n\u003ca name=\"features-reference-an-anchor-in-the-repository-json-configuration-1\"\u003e\u003c/a\u003e\n#### JSON Configuration\n\n| Name | Description | Default |\n| --- | --- | --- |\n| `name` | Anchor name. | N/A |\n\n\u003ca name=\"user-content-features-reference-an-anchor-in-the-repository-parser-configuration-2\"\u003e\u003c/a\u003e\n\u003ca name=\"features-reference-an-anchor-in-the-repository-parser-configuration-2\"\u003e\u003c/a\u003e\n#### Parser Configuration\n\n| Name | Description | Default |\n| --- | --- | --- |\n| `anchor.exclude` | Array of paths to exclude. | `['./dist/*']` |\n\n\u003ca name=\"user-content-features-variables\"\u003e\u003c/a\u003e\n\u003ca name=\"features-variables\"\u003e\u003c/a\u003e\n### Variables\n\n\n```json\n{\"gitdown\": \"variable\"}\n\n```\n\n\nPrints the value of a property defined under a parser `variable.scope` configuration property. Throws an error if property is not set.\n\n\u003ca name=\"user-content-features-variables-example-1\"\u003e\u003c/a\u003e\n\u003ca name=\"features-variables-example-1\"\u003e\u003c/a\u003e\n#### Example\n\n\n```js\nconst gitdown = Gitdown(\n  '{\"gitdown\": \"variable\", \"name\": \"name.first\"}' +\n  '{\"gitdown\": \"variable\", \"name\": \"name.last\"}'\n);\n\ngitdown.setConfig({\n  variable: {\n    scope: {\n      name: {\n        first: \"Gajus\",\n        last: \"Kuizinas\"\n      }\n    }\n  }\n});\n\n```\n\n\n\u003ca name=\"user-content-features-variables-json-configuration-2\"\u003e\u003c/a\u003e\n\u003ca name=\"features-variables-json-configuration-2\"\u003e\u003c/a\u003e\n#### JSON Configuration\n\n| Name | Description | Default |\n| --- | --- | --- |\n| `name` | Name of the property defined under a parser `variable.scope` configuration property. | N/A |\n\n\u003ca name=\"user-content-features-variables-parser-configuration-3\"\u003e\u003c/a\u003e\n\u003ca name=\"features-variables-parser-configuration-3\"\u003e\u003c/a\u003e\n#### Parser Configuration\n\n| Name | Description | Default |\n| --- | --- | --- |\n| `variable.scope` | Variable scope object. | `{}` |\n\n\u003ca name=\"user-content-features-include-file\"\u003e\u003c/a\u003e\n\u003ca name=\"features-include-file\"\u003e\u003c/a\u003e\n### Include File\n\n\n```json\n{\"gitdown\": \"include\"}\n\n```\n\n\nIncludes the contents of the file to the document.\n\nThe included file can have Gitdown JSON hooks.\n\n\u003ca name=\"user-content-features-include-file-example-2\"\u003e\u003c/a\u003e\n\u003ca name=\"features-include-file-example-2\"\u003e\u003c/a\u003e\n#### Example\n\nSee source code of [./.README/README.md](https://github.com/gajus/gitdown/blob/master/.README/README.md).\n\n\u003ca name=\"user-content-features-include-file-json-configuration-3\"\u003e\u003c/a\u003e\n\u003ca name=\"features-include-file-json-configuration-3\"\u003e\u003c/a\u003e\n#### JSON Configuration\n\n| Name | Description | Default |\n| --- | --- | --- |\n| `file` | Path to the file. The path is relative to the root of the repository. | N/A |\n\n\u003ca name=\"user-content-features-get-file-size\"\u003e\u003c/a\u003e\n\u003ca name=\"features-get-file-size\"\u003e\u003c/a\u003e\n### Get File Size\n\n\n```json\n{\"gitdown\": \"filesize\"}\n\n```\n\n\nReturns file size formatted in human friendly format.\n\n\u003ca name=\"user-content-features-get-file-size-example-3\"\u003e\u003c/a\u003e\n\u003ca name=\"features-get-file-size-example-3\"\u003e\u003c/a\u003e\n#### Example\n\n\n```json\n{\"gitdown\": \"filesize\", \"file\": \"src/gitdown.js\"}\n{\"gitdown\": \"filesize\", \"file\": \"src/gitdown.js\", \"gzip\": true}\n\n```\n\n\nGenerates:\n\n```markdown\n9.3 kB\n2.8 kB\n\n```\n\n\u003ca name=\"user-content-features-get-file-size-json-configuration-4\"\u003e\u003c/a\u003e\n\u003ca name=\"features-get-file-size-json-configuration-4\"\u003e\u003c/a\u003e\n#### JSON Configuration\n\n| Name | Description | Default |\n| --- | --- | --- |\n| `file` | Path to the file. The path is relative to the root of the repository. | N/A |\n| `gzip` | A boolean value indicating whether to gzip the file first. | `false` |\n\n\u003ca name=\"user-content-features-generate-badges\"\u003e\u003c/a\u003e\n\u003ca name=\"features-generate-badges\"\u003e\u003c/a\u003e\n### Generate Badges\n\n\n```json\n{\"gitdown\": \"badge\"}\n\n```\n\n\nGitdown generates markdown for badges using the environment variables, e.g. if it is an NPM badge, Gitdown will lookup the package name from `package.json`.\n\nBadges are generated using http://shields.io/.\n\n\u003ca name=\"user-content-features-generate-badges-supported-services\"\u003e\u003c/a\u003e\n\u003ca name=\"features-generate-badges-supported-services\"\u003e\u003c/a\u003e\n#### Supported Services\n\n| Name | Description |\n| --- | --- |\n| `npm-version` | [NPM](https://www.npmjs.org/) package version. |\n| `bower-version` | [Bower](http://bower.io/) package version. |\n| `travis` | State of the [Travis](https://travis-ci.org/) build. |\n| `david` | [David](https://david-dm.org/) state of the dependencies. |\n| `david-dev` | [David](https://david-dm.org/) state of the development dependencies. |\n| `waffle` | Issues ready on [Waffle](https://waffle.io/) board. |\n| `gitter` | Join [Gitter](https://gitter.im/) chat. |\n| `coveralls` | [Coveralls](https://coveralls.io/). |\n| `codeclimate-gpa` | [Code Climate](https://codeclimate.com/) GPA. |\n| `codeclimate-coverage` | [Code Climate](https://codeclimate.com/) test coverage. |\n| `appveyor` | [AppVeyor](http://www.appveyor.com/) status. |\n\nWhat service are you missing? [Raise an issue](https://github.com/gajus/gitdown/issues).\n\n\u003ca name=\"user-content-features-generate-badges-example-4\"\u003e\u003c/a\u003e\n\u003ca name=\"features-generate-badges-example-4\"\u003e\u003c/a\u003e\n#### Example\n\n\n```json\n{\"gitdown\": \"badge\", \"name\": \"npm-version\"}\n{\"gitdown\": \"badge\", \"name\": \"travis\"}\n{\"gitdown\": \"badge\", \"name\": \"david\"}\n\n```\n\n\nGenerates:\n\n```markdown\n[![NPM version](http://img.shields.io/npm/v/gitdown.svg?style=flat-square)](https://www.npmjs.org/package/gitdown)\n[![Travis build status](http://img.shields.io/travis/brettz9/gitdown/update-readme.svg?style=flat-square)](https://travis-ci.org/brettz9/gitdown)\n[![Dependency Status](https://img.shields.io/david/brettz9/gitdown.svg?style=flat-square)](https://david-dm.org/brettz9/gitdown)\n\n```\n\n\u003ca name=\"user-content-features-generate-badges-json-configuration-5\"\u003e\u003c/a\u003e\n\u003ca name=\"features-generate-badges-json-configuration-5\"\u003e\u003c/a\u003e\n#### JSON Configuration\n\n| Name | Description | Default |\n| --- | --- | --- |\n| `name` | Name of the service. | N/A |\n\n\u003ca name=\"user-content-features-print-date\"\u003e\u003c/a\u003e\n\u003ca name=\"features-print-date\"\u003e\u003c/a\u003e\n### Print Date\n\n\n```json\n{\"gitdown\": \"date\"}\n\n```\n\n\nPrints a string formatted according to the given [moment format](http://momentjs.com/docs/#/displaying/format/) string using the current time.\n\n\u003ca name=\"user-content-features-print-date-example-5\"\u003e\u003c/a\u003e\n\u003ca name=\"features-print-date-example-5\"\u003e\u003c/a\u003e\n#### Example\n\n\n```json\n{\"gitdown\": \"date\"}\n{\"gitdown\": \"date\", \"format\": \"YYYY\"}\n\n```\n\n\nGenerates:\n\n```markdown\n1563038327\n2019\n\n```\n\n\u003ca name=\"user-content-features-print-date-json-configuration-6\"\u003e\u003c/a\u003e\n\u003ca name=\"features-print-date-json-configuration-6\"\u003e\u003c/a\u003e\n#### JSON Configuration\n\n| Name | Description | Default |\n| --- | --- | --- |\n| `format` | [Moment format](http://momentjs.com/docs/#/displaying/format/). | `X` (UNIX timestamp) |\n\n\u003ca name=\"user-content-features-gitinfo\"\u003e\u003c/a\u003e\n\u003ca name=\"features-gitinfo\"\u003e\u003c/a\u003e\n### Gitinfo\n\n\n```json\n{\"gitdown\": \"gitinfo\"}\n\n```\n\n\n[Gitinfo](https://github.com/gajus/gitinfo) gets info about the local GitHub repository.\n\n\u003ca name=\"user-content-features-gitinfo-example-6\"\u003e\u003c/a\u003e\n\u003ca name=\"features-gitinfo-example-6\"\u003e\u003c/a\u003e\n#### Example\n\n\n```json\n{\"gitdown\": \"gitinfo\", \"name\": \"username\"}\n{\"gitdown\": \"gitinfo\", \"name\": \"name\"}\n{\"gitdown\": \"gitinfo\", \"name\": \"url\"}\n{\"gitdown\": \"gitinfo\", \"name\": \"branch\"}\n\n```\n\n\n```\nbrettz9\ngitdown\nhttps://github.com/brettz9/gitdown\nupdate-readme\n\n```\n\n\u003ca name=\"user-content-features-gitinfo-supported-properties\"\u003e\u003c/a\u003e\n\u003ca name=\"features-gitinfo-supported-properties\"\u003e\u003c/a\u003e\n#### Supported Properties\n\n|Name|Description|\n|---|---|\n|`username`|Username of the repository author.|\n|`name`|Repository name.|\n|`url`|Repository URL.|\n|`branch`|Current branch name.|\n\n\u003ca name=\"user-content-features-gitinfo-json-configuration-7\"\u003e\u003c/a\u003e\n\u003ca name=\"features-gitinfo-json-configuration-7\"\u003e\u003c/a\u003e\n#### JSON Configuration\n\n|Name|Description|Default|\n|---|---|---|\n|`name`|Name of the property.|N/A|\n\n\u003ca name=\"user-content-features-gitinfo-parser-configuration-4\"\u003e\u003c/a\u003e\n\u003ca name=\"features-gitinfo-parser-configuration-4\"\u003e\u003c/a\u003e\n#### Parser Configuration\n\n|Name|Description|Default|\n|---|---|---|\n|`gitinfo.defaultBranchName`|Default branch to use when the current branch name cannot be resolved.|N/A|\n|`gitinfo.gitPath`|Path to the `.git/` directory or a descendant. | `__dirname` of the script constructing an instance of `Gitdown`.|\n\n\n\u003ca name=\"user-content-recipes\"\u003e\u003c/a\u003e\n\u003ca name=\"recipes\"\u003e\u003c/a\u003e\n## Recipes\n\n\u003ca name=\"user-content-recipes-automating-gitdown\"\u003e\u003c/a\u003e\n\u003ca name=\"recipes-automating-gitdown\"\u003e\u003c/a\u003e\n### Automating Gitdown\n\nUse [Husky](https://www.npmjs.com/package/husky) to check if user generated README.md before committing his changes.\n\n```json\n\"husky\": {\n  \"hooks\": {\n    \"pre-commit\": \"npm run lint \u0026\u0026 npm run test \u0026\u0026 npm run build\",\n    \"pre-push\": \"gitdown ./.README/README.md --output-file ./README.md --check\",\n  }\n}\n\n```\n\n`--check` attributes makes Gitdown check if the target file differes from the source template. If the file differs then the program exits with an error code and message:\n\n\u003e Gitdown destination file does not represent the current state of the template.\n\nDo not automate generating and committing documentation: automating commits will result in a noisy commit log.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgajus%2Fgitdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgajus%2Fgitdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgajus%2Fgitdown/lists"}