add vale code formatting checks

This commit is contained in:
craig-osterhout 2022-11-15 07:14:10 -08:00
parent a521dc7678
commit 597d898942
3 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,9 @@
extends: existence
message: "Indent nested code blocks by 3 spaces and double-nested code blocks by 5 spaces."
link: https://docs.docker.com/contribute/style/formatting/#best-practice-for-commands
level: warning
scope: raw
# check for 1, 2, 4, 6 or more spaces at start of line before code fence (```)
#If not indented by 3 spaces at first level or 5 spaces at second level, then a hidden space is inserted and copied by the copy code feature.
raw:
- '(?m:^[ ]{4}\`\`\`|^[ ]{6,}\`\`\`|^[ ]{1}\`\`\`|^[ ]{2}\`\`\`)'

8
.github/vale/Docker/CodeOutput.yml vendored Normal file
View File

@ -0,0 +1,8 @@
extends: existence
message: "If you expect users to copy and run the command, specify output in a separate code block."
link: https://docs.docker.com/contribute/style/formatting/#best-practice-for-commands
level: warning
scope: raw
#check for console code fence followed by one line with $ or #, and not ending in `or \. Followed by more lines without $ or # and terminated by code fence
raw:
- '(?m:\`\`\`console\n+(\s*.*(\$|#).*[^\`\\]$)([^\$#(\`\`\`)]+\n)\s*\`\`\`)'

View File

@ -0,0 +1,8 @@
extends: existence
message: "If you expect users to copy and run the command, specify one command per code block."
link: https://docs.docker.com/contribute/style/formatting/#best-practice-for-commands
level: warning
scope: raw
#check for console code fence followed by two or more newlines with $ or #
raw:
- '(?m:\`\`\`console\n+(\s*.*(\$|#).*\n){2,})'