syavorsky/comment-parser

Description after tags

Closed this issue · 7 comments

Is it possible to support description after tags? e.g.

/**
 * @lsComponent
 * @lsLink http://google.com
 * @lsImg
 *
 * MyButton
 */

It is, let me bake an example. In meanwhile you can take a look at the parse(..., {tokenizers: ...}) option

In your example the MyButton description is associated with the last block tag; @lsImg. I don't think it's valid JSDoc for a general description to follow the block tags.

Well, unless you end the block tags with a @desc/@description block tag.

@fedotxxl there is currently no way to have a block description at the bottom, but you definitely can change the tag format from @tag {type} [name=default] description to @tag description. I know it's not exactly what you need, but text at the bottom may still be captured as a last tag's description. I added an example for this configuration. Note, the version is 1.1.0

@jaydenseric yep, it's may not valid JSDoc. Didn't mention that the library is targeted to parse JSDoc

@syavorsky yep, I'll try to make it working for my case

@fedotxxl When you use a comment that begins with /** , you are signalling to people and tools that the comment is JSDoc-like. Editor intellisense, syntax highlighting, ESLint linting of JSDoc comments, etc. are all activated.

If you are inventing a new type of documentation comment that is not JSDoc-like or compatible with existing JSDoc tooling, you should use a different opener, e.g.

/*specialopener
 * @foo bar
 *
 * Description at bottom.
 */

But, opting out of all the tooling around the industry standard JSDoc format is undesirable. I can't think of a good reason why you can't just put your descriptions at the start.

As @syavorsky says, you can always make your own tag to hold arbitrary text that doesn't fit the purpose of a standard JSDoc tag.

ok, I see. I've managed to implement my feature with description property