{"id":19986998,"url":"https://github.com/glayzzle/doc-parser","last_synced_at":"2025-05-04T08:31:05.900Z","repository":{"id":48446513,"uuid":"78099633","full_name":"glayzzle/doc-parser","owner":"glayzzle","description":":books: Documentation parser, doc blocks and annotations (fully compliant with phpDoc and doctrine annotations)","archived":false,"fork":false,"pushed_at":"2021-07-26T04:18:39.000Z","size":92,"stargazers_count":12,"open_issues_count":6,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-08T05:51:22.980Z","etag":null,"topics":["annotation-tool","annotations","docblock","documentation","documentation-tool","parse","parser"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/glayzzle.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}},"created_at":"2017-01-05T09:35:16.000Z","updated_at":"2022-12-23T04:44:31.000Z","dependencies_parsed_at":"2022-08-26T08:01:14.224Z","dependency_job_id":null,"html_url":"https://github.com/glayzzle/doc-parser","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glayzzle%2Fdoc-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glayzzle%2Fdoc-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glayzzle%2Fdoc-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glayzzle%2Fdoc-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glayzzle","download_url":"https://codeload.github.com/glayzzle/doc-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252307782,"owners_count":21727071,"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":["annotation-tool","annotations","docblock","documentation","documentation-tool","parse","parser"],"created_at":"2024-11-13T04:32:32.687Z","updated_at":"2025-05-04T08:31:00.892Z","avatar_url":"https://github.com/glayzzle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DocBlock \u0026 Annotations Parser\n\n[![npm version](https://badge.fury.io/js/doc-parser.svg)](https://www.npmjs.com/package/doc-parser)\n[![Build Status](https://travis-ci.org/glayzzle/doc-parser.svg?branch=master)](https://travis-ci.org/glayzzle/doc-parser)\n[![Coverage Status](https://coveralls.io/repos/github/glayzzle/doc-parser/badge.svg?branch=master\u0026v=1)](https://coveralls.io/github/glayzzle/doc-parser?branch=master)\n[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)\n[![Gitter](https://img.shields.io/badge/GITTER-join%20chat-green.svg)](https://gitter.im/glayzzle/Lobby)\n\nThis library is a javascript LALR(1) parser that parses docblocks and extracts\nannotations under an structured syntax tree.\n\n# Install\n\n```sh\nnpm install doc-parser --save\n```\n\nAnd simple usage :\n\n```js\nvar DocParser = require('doc-parser');\nvar reader = new DocParser();\nvar data = reader.parse('/** @hello world */');\n```\n\n\n# Supported syntaxes\n\n```php\n/**\n * Some description\n * @return boolean\n * @return map\u003cstring, SomeClass\u003e\n * @author Ioan CHIRIAC \u003cme@domain.com\u003e\n * @throws Exception\n * @deprecated\n * @table('tableName', true)\n * @table(\n *   name='tableName',\n *   primary=true\n * )\n * @annotation1 @annotation2\n * @Target([\"METHOD\", \"PROPERTY\"])\n * @Attributes([\n *   @Attribute(\"stringProperty\", type = \"string\"),\n *   @Attribute(\"annotProperty\",  type = \"SomeAnnotationClass\"),\n * ])\n * @json({\n *   \"key\": \"value\",\n *   \"object\": { \"inner\": true },\n *   \"list\": [1, 2, 3]\n * })\n * \u003cnode\u003e\n * Some inner multi line content\n * \u003c/node\u003e\n */\n```\n\n# AST structure\n\n```js\n{\n  kind: 'doc',\n  summary: 'Some description retrieved from the first line of the coment',\n  body: [\n    {\n      kind: 'return',\n      type: 'void',\n      description: 'Some extra informations'\n    }\n  ]\n}\n```\n\n# Declaring custom doc blocks\n\nBy default, `doc-parser` supports `@return`,`@param`,`@throws` and `@deprecated`\ndoc blocks.\n\nYou can extend the support to any doc block :\n\n```js\n// lets handle @global (type) (var) (description)\nvar DocParser = require('doc-parser');\nvar reader = new DocParser({\n  'global': [\n    {\n      property: 'type',\n      parser: 'type',\n      optional: true\n    },\n    {\n      property: 'what',\n      parser: 'variable',\n      optional: true\n    },\n    {\n      property: 'description',\n      parser: 'text',\n      optional: true,\n      default: ''\n    }\n  ]\n});\nvar data = reader.parse('/** @global string some description */');\n```\n\nThis will result in a new kind of doc block with the specified properties. Here\na list of supported parsers :\n\n- type : a simple type, class name, or array of types\n- variable : a variable name\n- text : a line of text (will eat every token until the current line ends)\n- version: a semantic version\n- array : an array of items\n- object : a json object definition\n- boolean : a boolean\n- number : a number (integer or float)\n- string : a simple or double quoted text\n\n# Misc\n\nThis library is released under BSD-3 license clause.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglayzzle%2Fdoc-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglayzzle%2Fdoc-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglayzzle%2Fdoc-parser/lists"}