Package Exports
- comment-parser
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (comment-parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
comment-parser
Generic JSDoc-like comment parser. This library is not intended to be documentation generator, but rather composite unit for it.
npm install comment-parser
Module provides parse(s:String):Object
function which takes /** ... */
comment string and returns array of objects with parsed data.
It is not trying to detect relations between tags or somehow recognize their meaning. Any tag can be used, as long as it satisfies the format.
/**
* Singleline or multiline description text. Line breaks are preserved.
*
* @some-tag {Type} name Singleline or multiline description text
* @some-tag {Type} name.subname Singleline or multiline description text
* @some-tag {Type} name.subname.subsubname Singleline or
* multiline description text
* @another-tag
*/
this would be parsed into following
[{
tags: [{
tag: "some-tag",
type: "Type",
name: "name",
description: "Singleline or multiline description text",
tags: [{
tag: "some-tag",
type: "Type",
name: "subname",
description: "Singleline or multiline description text",
tags: [{
tag: "some-tag",
type: "Type",
name: "subsubname",
description: "Singleline or\nmultiline description text"
}]
}]
}, {
tag: "another-tag",
type: "",
name: "",
description: ""
}],
description: "Singleline or multiline description text. Line breaks are preserved."
}]
Invalid comment blocks are skipped. Comments starting with /*
and /***
are considered not valid.
Also you can parse entire file with parse.file('path/to/file', callback)
or acquire an instance of Transform stream with parse.stream()
.
Happy coding :)