-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: use markdownlint to enforce mkdocs compatibility
mkdocs uses a markdown renderer that is hardcoded to 4 spaces per tab for detecting indentation levels, including ordered- and unordered-lists. Since we cannot easily change the renderer, begin using a markdown linter in CI that will fail if official docs do not adhere to the spacing rules. As a starting point, the markdownlint config does not begin with the default set of checks, which might overwhelm attempts to fix them. Instead, focus on list-tab-spacing rules and a few other highly useful checks. markdownlint also has some gaps in its abilities that allow common Rook doc issues to pass acceptance. Particularly, these gaps involve code blocks that appear in list items. Prettier is a code formatter that can be run in `--check` mode that -- when configured to use tab size 4 -- allows checking for these kinds of doc errors. However, Prettier is very opinionated, and it requires some formatting changes that are non-ideal. For example, unordered lists are also forcefully intended to 4 spaces. Additionally, because of Prettier's formatting, we must now use the below format for callouts, including the space: ``` !!! note callout text ``` These drawbacks are minor compared to the ability to ensure with great accuracy that our `Documentation/` markdown files will render without bugs. Signed-off-by: Blaine Gardner <blaine.gardner@ibm.com>
- Loading branch information
Showing
80 changed files
with
2,668 additions
and
2,359 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module.exports = { | ||
"config": { | ||
"default": false, // no default rules enabled | ||
"extends": null, // no default rules enabled | ||
"list-indent": true, // all list items must be indented at the same level | ||
"ul-indent": { | ||
"indent": 4, // mkdocs requires 4 spaces for tabs | ||
}, | ||
"no-hard-tabs": { | ||
"spaces_per_tab": 4, // mkdocs requires 4 spaces for tabs | ||
}, | ||
"ol-prefix": { | ||
// require fully-numbered lists. this rule helps ensure that code blocks in between ordered | ||
// list items (which require surrounding spaces) don't break lists | ||
"style": "ordered", | ||
}, | ||
"blanks-around-lists": true, // mkdocs requires blank lines around lists | ||
"blanks-around-fences": { // mkdocs requires blank lines around code blocks (fences) | ||
"list_items": true, /// ... including in lists | ||
}, | ||
"fenced-code-language": { | ||
// enforce code blocks must have language specified | ||
// this helps ensure rendering is as intended, and it helps doc-wide searches for code blocks | ||
language_only: true, | ||
}, | ||
"no-duplicate-heading": true, // do not allow duplicate headings | ||
"link-fragments": true, // validate links to headings within a doc | ||
"single-trailing-newline": true, // require single trailing newline in docs | ||
"no-multiple-blanks": { | ||
"maximum": 1, // prettier does this, but markdownlint provides better feedback in CI | ||
}, | ||
|
||
// custom rule for rook, defined below | ||
"mkdocs-prettier-admonitions": true, | ||
}, | ||
"customRules": [ | ||
"./tests/scripts/markdownlint-check-callouts.js", | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# use prettier to format docs that are rendered with mkdocs | ||
# e.g., ONLY format the Documentation directory | ||
/* | ||
/Documentation/Helm-Charts/ | ||
!Documentation/ | ||
!README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"tabWidth": 4, | ||
"useTabs": false, | ||
"embeddedLanguageFormatting": "off", | ||
"parser": "markdown" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.