jonschlinkert / parse-comments

Parse JavaScript code comments. Works with block and line comments, and should work with CSS, LESS, SASS, or any language with the same comment formats.
https://github.com/jonschlinkert
MIT License
66 stars 23 forks source link

Remove the carrot (`) from the parseParams regex? #10

Open tunnckoCore opened 7 years ago

tunnckoCore commented 7 years ago

It can be found at https://github.com/jonschlinkert/parse-comments/blob/master/index.js#L126. And the intention of that is because it is not standard jsdoc, so syntax highlighting is different.

source code

/**
 * > Make an array from any value.
 *
 * @param  {Any} `val` some long description
 * @return {Array}
 * @api private
 */

let arrayify = (val) => {
  if (!val) return []
  if (Array.isArray(val)) return val
  return [val]
}

without carrot

2017-01-18-19 36 58_445x309_scrot

with carrot

2017-01-18-19 37 35_481x296_scrot

notice the val

More better would be to wrap with ` later, instead of relay on that

jonschlinkert commented 7 years ago

In a future version, you will be able to customize this to be like js-doc. Although I personally dislike that format because it's not clear to readers or parsers what's really intended. There are always exceptions where js-doc is wrong.

tunnckoCore commented 5 years ago

it's not clear to readers or parsers what's really intended

What's not clear? It's always "the thing between the end of type and start of description. Whatever it be, it's always between two spaces.

I'll try later the whole v1 to see what's done.

jonschlinkert commented 5 years ago

It's always "the thing between the end of type and start of description.

Only on certain tags. Which is irritating, because it's not documented well. There is no official specification that I'm aware of. I tested hundreds of tags against 5 or 6 popular libs and the results were inconsistent.

jonschlinkert commented 5 years ago

I'll try later the whole v1 to see what's done.

Great! Fwiw you might find this helpful: https://github.com/jonschlinkert/parse-comments/blob/master/docs/content/comparison.md. The "type" parsing was one of the most complicated parts of this.