vale icon indicating copy to clipboard operation
vale copied to clipboard

Comments in markdown trigger erroneous spelling error

Open rbdixon opened this issue 1 year ago • 1 comments

Check for existing issues

  • [X] Completed

Environment

Reproducible on:

  • MacOS, installed via homebrew, vale version 3.6.1
  • MacOS, GitHub binary, vale version 3.7.0

Describe the bug / provide steps to reproduce it

With the default config:

MinAlertLevel = suggestion

[*]
BasedOnStyles = Vale

This test document:

on <!-- TODO --> a 
sonata

Triggers a spelling error:

$ ./vale test.md 

 test.md
 2:2  error  Did you really mean 'ona'?  Vale.Spelling 

✖ 1 error, 0 warnings and 0 suggestions in 1 file.

My expectation was no errors would be reported.

Remove the comment in the test document and no errors are reported.

The pattern seems to be that the non-comment characters on the first line, in this case on and a, will be flagged as a spelling error on their first usage after the comment. If you break the HTML comment, like this < !-- TODO -->, the unexpected behavior does not occur.

Another failing example is:

on <span/> a 
sonata

By setting BlockIgnores = (?s) (<!--.*?-->)|(<[^>]+\/>) will workaround this issue. This does not, however, explain the unusual behavior where a portion of a valid word is flagged as a spelling error based on the preceding line.

rbdixon avatar Aug 07 '24 20:08 rbdixon

Good catch. Wonderful workaround

ccoVeille avatar Aug 07 '24 20:08 ccoVeille