errata-ai / vale

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

TokenIgnores not picking up errors in different lines #409

Closed ramyaparimi closed 2 years ago

ramyaparimi commented 2 years ago

I have a regex in TokenIgnores to ignore contents in markdown bold. Example: **term**. But terms in bold are still picked up as errors. Is there something I am missing to provide for TokenIgnores to not lint terms i bold? Here is my .vale.ini

StylesPath = vale-styles

# suggestion, warning or error
MinAlertLevel = warning 

Vocab = GitHub

[*.md]
BasedOnStyles = Vale, GitHub

TokenIgnores = {%.*?%}, \ 
               {{.*?}}, \  
               (.|\/|-)?github(\/|-)?, \
               \(\/.*?\), \
               (\`{1}((.|\n)*?)\`{1}), \
               (\*{1}((.|\n)*?)\*{1}), \
               (\*{2}((.|\n)*?)\*{2}), \
               \[([^\[]+)\](\(.*\))

; \(\/.*?\), \  url in Markdown link, ex: (/rel/path/foo/bar)
; \[([^\[]+)\](\(.*\)) Link name and url in markdown ex : [link](url)
; {%.*?%}, \  liquid tag
; {{.*?}}, \    liquid object
; (.|\/|-)?github(\/|-)?  github in a relative path
; (\`{1}((.|\n)*?)\`{1}) backticks ex: `term`
; (\`{3}((.|\n)*?)\`{3}) codeblock
; (?s) *\_{1}((.|\n)*?)\_{1}, \ ignore file format _file_
; \*\*(.*)\*\*/ terms in bold
; vale --output=line --glob='!content/github/site-policy*.md' content > vale/vale-errors.txt 
; vale --glob='!content/github/site-policy*.md' content 

This the error:

image
jdkato commented 2 years ago

I feel like we've had this discussion a few times already, and my comment here still applies.

Your configuration, as written, isn’t going to work.

I would start by removing all TokenIgnores entries for non-Liquid syntax.

ramyaparimi commented 2 years ago

Thanks so much for getting back. I apologize for repeatedly asking the same question. I will try deleting all the non liquid ToeknIgnores and trying it out once more.

ramyaparimi commented 2 years ago

Thanks so much for your suggestions. I removed all non liquid regex from my vale config.

StylesPath = vale

# suggestion, warning or error
MinAlertLevel = warning

Vocab = Docs

[*.md]
BasedOnStyles = Vale,Vocab

TokenIgnores = {%.*?%}, \ 
               {{.*?}}

Could you please let me know what I can do if terms from markdown links are picked up as error:

image
jdkato commented 2 years ago

Could you provide the contents of (or a link to) the file?

ramyaparimi commented 2 years ago

Sorry for forgetting to include earlier. It is L21 in this link:

https://github.com/github/docs/edit/main/content/account-and-profile/setting-up-and-managing-your-github-user-account/managing-user-account-settings/integrating-jira-with-your-personal-projects.md

jdkato commented 2 years ago

I can't reproduce the issue (although it looks like the file has changed since your screenshot):

Screen Shot 2022-02-23 at 10 18 20 AM

Both standard Markdown links and image URLs should be ignored by default. If they aren't, it's usually due to there being either non-standard syntax in the file (such as Liquid tags) or a misbehaving BlockIgnores / TokenIgnores pattern.

ramyaparimi commented 2 years ago

Thanks so much for looking into it. I noticed that when syntax/spacing isn't followed properly, Vale is picking up terms from code blocks. For example, when a new line character is added between liquid tag and code block as per , Vale isn't picking up terms from code block. I wonder if it something similar with Vale picking up from markdown links.

image

I will post here if I find something related to that. Thanks so much for your time and help 💖