{"id":16127287,"url":"https://github.com/gr0uch/doc-tree","last_synced_at":"2025-06-23T05:07:21.214Z","repository":{"id":26714432,"uuid":"30171759","full_name":"gr0uch/doc-tree","owner":"gr0uch","description":"Documentation generating tool for JavaScript that matches comments to AST nodes.","archived":false,"fork":false,"pushed_at":"2023-04-16T02:11:46.000Z","size":348,"stargazers_count":58,"open_issues_count":5,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-09T20:03:14.107Z","etag":null,"topics":["documentation-tool","jsdoc"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gr0uch.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":"2015-02-02T04:56:11.000Z","updated_at":"2024-08-24T22:52:41.000Z","dependencies_parsed_at":"2024-06-21T14:14:42.939Z","dependency_job_id":"57a02349-4523-469c-96a7-00a96d2050a9","html_url":"https://github.com/gr0uch/doc-tree","commit_stats":null,"previous_names":["sapeien/doc-tree","0x8890/docchi"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/gr0uch/doc-tree","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gr0uch%2Fdoc-tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gr0uch%2Fdoc-tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gr0uch%2Fdoc-tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gr0uch%2Fdoc-tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gr0uch","download_url":"https://codeload.github.com/gr0uch/doc-tree/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gr0uch%2Fdoc-tree/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261003209,"owners_count":23095683,"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":["documentation-tool","jsdoc"],"created_at":"2024-10-09T21:43:43.515Z","updated_at":"2025-06-23T05:07:16.197Z","avatar_url":"https://github.com/gr0uch.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# doc-tree\n\n[![Build Status](https://img.shields.io/travis/daliwali/doc-tree/master.svg?style=flat-square)](https://travis-ci.org/daliwali/doc-tree)\n[![npm Version](https://img.shields.io/npm/v/doc-tree.svg?style=flat-square)](https://www.npmjs.com/package/doc-tree)\n[![License](https://img.shields.io/npm/l/doc-tree.svg?style=flat-square)](https://raw.githubusercontent.com/daliwali/doc-tree/master/LICENSE)\n\n`doc-tree` parses comments in JavaScript code and outputs the structure and context of the comments in any particular format, JSDoc is the default but any documentation parsing function can be supplied. It traverses the Abstract Syntax Tree (AST) to determine the context of a comment. Basically it's glue code between the AST parser [Acorn](https://github.com/marijnh/acorn), and the JSDoc parser [Doctrine](https://github.com/Constellation/doctrine), though any user-supplied parsing function may be used.\n\nGet it from `npm`:\n\n```sh\n$ npm install -g doc-tree\n```\n\n\n## Usage\n\n`doc-tree` operates over `stdio`. Running `doc-tree` on its own source code, and outputting the result to `docs.json`:\n\n```sh\n$ doc-tree \u003c lib/index.js \u003e docs.json\n```\n\nOr you could use it programmatically, as part of a Node-based build script:\n\n```js\nimport fs from 'fs'\nimport docTree from 'doc-tree'\n\n// Parse a string or a buffer.\nlet doc = docTree.parse(fs.readFileSync('example.js'))\n\n// An array of parsed comments matched with their contexts.\nlet output = doc.output()\n```\n\nThe `output` method accepts 2 arguments, a function that accepts a comment and returns anything, and an `options` object to pass to the custom function or the built-in parser, Doctrine.\n\n\n## Example\n\nThis code documentation:\n\n```js\n/**\n * This is a **Foo** class.\n */\nclass Foo {\n    /**\n     * This is the constructor.\n     *\n     * @param {Object} options\n     */\n    constructor (options) { ... }\n}\n```\n\nGets outputted as:\n\n```js\n[{ comment: { description: '\u003cp\u003eThis is a \u003cstrong\u003eFoo\u003c/strong\u003e class.\u003c/p\u003e', tags: [] },\n   context: { location: { start: [Object], end: [Object] },\n              name: 'Foo', type: 'class' }\n },\n { comment: { description: '\u003cp\u003eThis is the constructor.\u003c/p\u003e', tags: [Object] },\n   context: { location: { start: [Object], end: [Object] },\n              type: 'constructor', target: 'Foo' }\n}]\n```\n\nDescriptions are rendered into HTML using CommonMark. Use `{ render: false }` in the options for `output` to turn it off.\n\nThe default JSDoc parser will only consider block comments that start with `/**`.\n\n\n## License\n\nThis software is licensed under the [GNU General Public License v3](https://github.com/daliwali/doc-tree/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgr0uch%2Fdoc-tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgr0uch%2Fdoc-tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgr0uch%2Fdoc-tree/lists"}