runem / web-component-analyzer

CLI that analyzes web components and emits documentation
https://runem.github.io/web-component-analyzer
MIT License
501 stars 63 forks source link

Analyzer fails when using CSS snippets with @-rules in description #151

Closed web-padawan closed 4 years ago

web-padawan commented 4 years ago

The following code snippet can't be parsed by analyzer:

 * expand the layout to full document height as follows:
 * ```
 * @media screen {
 *   html, body {
 *     height: 100%;
 *   }
 * }
 * ```

Output JSON for description field looks like this:

expand the layout to full document height as follows:\n```",

See example at vaadin/vaadin-app-layout#149

runem commented 4 years ago

Thanks for opening this issue :+1:

It seems like the Typescript parser thinks @media is a JSDoc tag.

See example at ts-ast-viewer.com

Screenshot 2020-03-06 at 11 03 40

This would either need to be fixed in the Typescript parser, or I would have to get around this problem by searching for unclosed quotes and collect invalid parsed JSDoc tags into one single description.

Another solution could be to add support for quoting the @ like this: \@. This would be the easiest solution to implement.

A temporary solution for you could be to replace @ with the character, but I know it's not optimal.

web-padawan commented 4 years ago

Another solution could be to add support for quoting the @ like this: \@. This would be the easiest solution to implement.

Thanks, this looks like a good workaround 👍