syavorsky/comment-parser

Consider loosening tag title

Closed this issue · 2 comments

While your PARSERS.parse_tag is more liberal in allowing any non-whitespace, your parse_block function--called by the return function of mkextract and used by your parse public API--is more strict in insisting that what jsdoc calls a tag "title" and what you parse as "tag" begins with \w.

This seems to contradict the greater looseness of jsdoc itself, which merely requires \S: https://github.com/jsdoc/jsdoc/blob/aa0b6c1bfa3ab1aea10e579f9d6168fcb8ad5332/lib/jsdoc/doclet.js#L124

I'd suggest loosening the requirement here too so that you are using \S in both places, in a manner consistent with jsdoc. For example, while the following should create two tags:

/**
 * @aTag
 * @-anotherTag {Type} name Singleline or multiline description text
text
 */

...the results, instead merge -anotherTag with the previous aTag one: https://runkit.com/brettz9/runkit-npm-comment-parser-tag-issue

It'd admittedly probably be pretty rare to have something like the above, but since jsdoc allows it, I thought I'd mention it.

I'm filing this in the course of trying to find out what a valid (custom) tag can be, and as such, I think that even if you keep the old way, I think it'd be worth quickly mentioning in the docs the original requirements and how yours differs.

@brettz9 thanks for pointing out, good suggestion. Published

Great, thanks!