errata-ai / vale

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

TokenIgnores not working in DITA #407

Open jiewang2 opened 2 years ago

jiewang2 commented 2 years ago

Hi,

I have the TokenIgnores setting as follows in the .vale.ini:

[*]
TokenIgnores = (\[.+\][^(])

This rule should ignore anything wrapped with the square brackets except markdown links. It works for the following content in markdown, but it's not working for the same content in .dita (still reporting errors): [if it rains, i will not go].

landure commented 2 years ago

Hi,

as far as i can understand, your regex is invalid.

To match [if it rains, i will not go], the regex should be (\[.+\])

To match [if it rains, i will not go](, the regex should be (\[.+\]\()

To match [if it rains, i will not go]something-other-than-opening-parenthesis, the regex should be (\[.+\][^\(])

In this last case, you are not escaping the opening parenthesis in the brakets.

You can use regex101 for Golang to debug Vale regular expressions.

jdkato commented 2 years ago

You don't have to escape values inside a character class.

The problem here is that ignore patterns aren't yet supported in DITA.

landure commented 2 years ago

Ok, my bad... i need to review my regex knowledge.

jdillard commented 1 year ago

The problem here is that ignore patterns aren't yet supported in DITA.

Should the list of supported markups be added to the TokenIgnores for the time being? If so, and a list is provided, I can make a docs PR to add it.

edit: I ended up making a PR here: https://github.com/errata-ai/vale.sh/pull/30