-
Notifications
You must be signed in to change notification settings - Fork 6
Add Vale for content linting to the repo #541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 29 commits
887e0e0
2a2348c
b091a30
a0e8d26
ca5a045
e32d217
5293621
77fd9a0
915a6e8
d83fe9b
703f01e
e1d5b39
31dd235
6fead66
815e295
2076cd7
fa2ec11
36ddf8c
8539fe0
db62870
1f0983c
3d1617e
a2af066
f5201d8
7b25e03
808b1e7
bf1841f
f8aad48
a20c799
73fd5c1
3adfd7b
f53e939
3748887
245674e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,27 @@ | ||||||
StylesPath = .github/styles | ||||||
|
||||||
# https://github.com/errata-ai/packages | ||||||
Packages = proselint,\ | ||||||
write-good | ||||||
|
||||||
[*.md] | ||||||
BasedOnStyles = proselint,\ | ||||||
Vale,\ | ||||||
write-good | ||||||
|
||||||
# Disable | ||||||
Vale.Spelling = NO | ||||||
write-good.E-Prime = NO | ||||||
write-good.Passive = NO | ||||||
write-good.TooWordy = NO | ||||||
|
||||||
# Ignore lines starting with "> [!NOTE]" | ||||||
paddyroddy marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
BlockIgnores = (?s)> \[!NOTE\].*?(\n|$) | ||||||
|
BlockIgnores = (?s)> \[!NOTE\].*?(\n|$) | |
BlockIgnores = (?s)> \[!(CAUTION|IMPORTANT|NOTE|TIP|WARNING)\].*?(\n|$) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah they would be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah so it was the > ![NOTE]
alert syntax specifically that was triggering not the content of the alert? I guess we could also include the other alert types here (!TIP
, !IMPORTANT
, !WARNING
, !CAUTION
). I don't entirely understand the regex here - it looks like Value uses regexp2
which is based on Go regexp
, but after reading the docs I'm still entirely sure what (?s)
bit is doing here (appears to be setting a flag to let .
match \n
but not sure why this is needed and whether it applies just to the group?). I think something like
^ *> \[!(NOTE|IMPORTANT|WARNING|CAUTION|TIP)\] *$
would avoid unintentionally capturing other characters with .
while still allowing for white space before or after alert syntax (could also use \w
in place of
but not sure we actually want to allow for other white space types).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just spotted that you've already covered all altert types in last commit 73fd5c1 - I still don't entirely understand the regex but it works so marking as resolved! (EDIT: I hadn't refreshed before commenting so hadn't seem Sam's comment either).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I assume you meant \s
in place of
? Hadn't occurred to me that \s
was any type of whitespace. This is just in this flavour of regex? I've always taken it to mean strictly
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah bad news, yours doesn't work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So in the example linked to in the docs there it looks like it's excluding the whole block {< file }
delimited block. Are we trying to similarly ignore the context of callouts or just the syntax which starts an alert? From https://regex101.com/r/rvRsMy/1 it looks like we just match the initial bit not the content. If so I think the regex I suggested will do so as well but is tighter / less chance for false matches
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Went with (?s)> \[!(CAUTION|IMPORTANT|NOTE|TIP|WARNING)\](\n|$)
and tested on regex101
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we want to just ignore the top line itself, not the contents within it. Your regex doesn't work, feel free to try it yourself locally (run vale sync; vale .
)
Uh oh!
There was an error while loading. Please reload this page.