errata-ai / vale

:pencil: A markup-aware linter for prose built with speed and extensibility in mind.
https://vale.sh
MIT License
4.51k stars 155 forks source link

Does IgnoreClasses ignore just a DOM element, or a DOM element and all of its children? #477

Closed faunaee closed 2 years ago

faunaee commented 2 years ago

I'm on macOS 12.5, M1 Pro, vale 2.20.1.

In my vale.ini, when I specify:

IgnoredClasses = metrics

I would expect Google style definitions (from https://github.com/errata-ai/Google) to skip processing this HTML:

<div class="sidebarblock metrics">
<div class="content">
<div class="title">Query&#160;metrics:</div>
<div class="ulist">
<ul>
<li>
<p><strong>&#160;queryTime</strong>: 33ms</p>
</li>
</ul>
</div>
</div>
</div>
</div>

But I still get the error:

1624:38   error    Put a nonbreaking space         Google.Units       
                   between the number and the                         
                   unit in '33ms'.

Does IgnoredClasses only work on the DOM element where the class is specified, or does it work on the DOM element and its child elements?

Supplementary question: If IgnoreClasses only works on the DOM element where the class is specified, how can I cause the style rule to be ignored for the child element without introducing Vale on/off comments? That content is machine-generated and must appear unmodified.

faunaee commented 2 years ago

In addition, if I use the following definition:

IgnoredClasses = blurb

And my HTML contains:

<div class="blurb">
  <svg>...</svg>
  Thanks!
</div>

I get the warning:

 2060:31  error  Don't use exclamation points    Google.Exclamation 
                 in text. 

If I remove the embedded SVG, Vale then ignores the element.

It seems like Vale can only use IgnoredClasses on a DOM element that only contains text. It would be great if it could ignore the element and all of its children.