SassDoc / sassdoc

Release the docs!
http://sassdoc.com
MIT License
1.41k stars 56 forks source link

$ symbol in @require description. #510

Open MathiasSM opened 7 years ago

MathiasSM commented 7 years ago

The current regex:

^\s*(?:\{(.*)\})?\s*(?:(\$?[^\s]+))?\s*(?:-?\s*([^<$]*))?\s*(?:<?\s*(.*)\s*>)?$

Explicitly disallows using the $ symbol inside the description/comment section of a @require annotation. It is allowed in @returns and the like, so I wonder why it's not here.

That's my first issue. My second issue is that I had to look up in the code to figure out why SassDoc was crashing. I was using several annotations with the $, so pin-pointing the wrong line was impossible with just my code. It should throw a human-friendly error (which, being this a regex thing, could be quite a challenge to say "hey, no money here!", but could be easy to say "wrong syntax for description" or something... Instead of:

/Users/mathias/.nodenv/versions/6.9.5/lib/node_modules/sassdoc/dist/annotation/annotations/require.js:31
        type: match[1] || 'function',
                   ^

Don't you think?