diff --git a/styles/Canonical/026-hints-tips.yml b/styles/Canonical/026-hints-tips.yml new file mode 100644 index 0000000..7017291 --- /dev/null +++ b/styles/Canonical/026-hints-tips.yml @@ -0,0 +1,12 @@ +# 026 - Hint and tip blocks + +extends: existence +message: "Avoid 'hint' and 'tip' admonitions. Instead, use a regular paragraph or the 'admonition' directive with a descriptive title." +scope: raw +nonword: true +level: suggestion +tokens: + - '.. hint::' + - '.. tip::' + - '(````*|::::*) *?{hint}' + - '(````*|::::*) *?{tip}' diff --git a/tests/data/manifest.yml b/tests/data/manifest.yml index ef7abc8..71798f0 100644 --- a/tests/data/manifest.yml +++ b/tests/data/manifest.yml @@ -2050,3 +2050,49 @@ rules: Line 35 Line 36 severity: warning + 026-hints-tips: + cases: + - id: valid + filetypes: [md, rst] + content: | + .. hint:: + This is a reST hint. + .. tip:: + This is a reST tip. + ```{hint} + This is a MyST hint. + ``` + ```{tip} + This is a MyST tip. + ``` + ````{hint} + This is a deeper MyST hint. + ```` + ````{tip} + This is a deeper MyST tip. + ```` + :::{hint} + This is a colon-fenced MyST hint. + ::: + :::{tip} + This is a colon-fenced MyST tip. + ::: + ::::{hint} + This is a deeper colon-fenced MyST hint. + :::: + ::::{tip} + This is a deeper colon-fenced MyST tip. + :::: + expect: + triggers: + - '.. hint::' + - '.. tip::' + - '```{hint}' + - '```{tip}' + - '````{hint}' + - '````{tip}' + - ':::{hint}' + - ':::{tip}' + - '::::{hint}' + - '::::{tip}' + severity: suggestion diff --git a/vale.ini b/vale.ini index 72939ac..9289aa0 100644 --- a/vale.ini +++ b/vale.ini @@ -29,6 +29,7 @@ Canonical.019-no-google-drive-images = error Canonical.025a-latinisms-with-english-equivalents = suggestion Canonical.025b-latinisms-to-reconsider = suggestion Canonical.025c-latinisms-to-avoid = suggestion +Canonical.026-hints-tips = suggestion Canonical.400-Enforce-inclusive-terms = error Canonical.500-Repeated-words = warning