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
ci: use markdownlint to enforce mkdocs compatibility #14114
Conversation
55f04e9
to
0f80258
Compare
@travisn @parth-gr @galexrt related to this PR (and others) #13968 (comment) mkdocs's yaml parser is adamant that they will not support 2-spaces-per-tab, and they require 4 spaces. Mkdocs devs are adamant that they won't support modifying the parser or this particular behavior. This means that our current docs will render fine in github/vscode, but not on the website. The best way I could find to fix our docs without switching to something other than mkdocs is to do 2 things:
As of now, I haven't fixed any lint issues. I wanted to discuss and decide how to proceed from here before doing that. |
0f80258
to
6a4b0c9
Compare
* `erasureCoded`: Settings for an erasure-coded pool. If specified, `replicated` settings must not be specified. See below for more details on [erasure coding](#erasure-coding). | ||
* `replicasPerFailureDomain`: Sets up the number of replicas to place in a given failure domain. For instance, if the failure domain is a datacenter (cluster is stretched) then you will have 2 replicas per datacenter where each replica ends up on a different host. This gives you a total of 4 replicas and for this, the `size` must be set to 4. The default is 1. | ||
* `subFailureDomain`: Name of the CRUSH bucket representing a sub-failure domain. In a stretched configuration this option represent the "last" bucket where replicas will end up being written. Imagine the cluster is stretched across two datacenters, you can then have 2 copies per datacenter and each copy on a different CRUSH bucket. The default is "host". | ||
* `erasureCoded`: Settings for an erasure-coded pool. If specified, `replicated` settings must not be specified. See below for more details on [erasure coding](#erasure-coding). |
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.
Are the spaces between the *
and first word intentional? That doesn't seem expected to me.
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.
Yes. We can chat more about some of the weird things that this is going to be requiring like this one.
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.
markdownlint really isn't all that great as a tool. It particularly has gaps in requiring 4-space tabs throughout the full document. It will only force it on list items but not the paragraph conentents of list items.
Rook uses a lot of lists with multiple paragraphs and code blocks inside lists, which mkdocs won't render properly unless those are indented very exactly.
I had to find something else that we could use to help fill in this particular gap. The tool called "Prettier" was commonly recommended for markdown, and I found that using its --tab-width=4
option helps to ensure that paragraph contents (especially code blocks) are spaced appropriately to be rendered by mkdocs and/or flagged as an error by markdownlint.
The downside is that Prettier is VERY opinionated. It requires using -
for bullet points, and it requires that bullet points adhere to the tab-width option. It also doesn't like the standard callout/admonition syntax and requires a newline between the callout header and text.
IMO, this is certainly not ideal, but it is much more usable than having docs that render properly on github but silently fail (and create subtle bugs) in user-facing docs.
9c69946
to
097babe
Compare
This pull request has merge conflicts that must be resolved before it can be merged. @BlaineEXE please rebase it. https://rook.io/docs/rook/latest/Contributing/development-flow/#updating-your-fork |
65e6ae1
to
5c91d69
Compare
edcd49c
to
949508f
Compare
This pull request has merge conflicts that must be resolved before it can be merged. @BlaineEXE please rebase it. https://rook.io/docs/rook/latest/Contributing/development-flow/#updating-your-fork |
949508f
to
9b480a3
Compare
119f154
to
eca9010
Compare
Latest updates (from Friday)
For consideration: The main reason why I also included 'Prettier' was because markdownlint didn't have a good way of checking that all lines are indented to a 4-space boundary (for mkdocs) Now that I know how to write custom markdownlint modules, it would be fairly simple to write one to ensure this 4-space boundary This would allow us to get rid of 'Prettier' if we want, with some pros/cons:
|
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.
Are you saying you created that custom rule locally? Or it's part of this PR and we will have it going forward?
If we already have the custom linter, maybe it would be good to get rid of prettier if we don't need it. But whatever you think is simplest to get this done and not spend too much more time on it.
_ `replicasPerFailureDomain`: Sets up the number of replicas to place in a given failure domain. For instance, if the failure domain is a datacenter (cluster is | ||
stretched) then you will have 2 replicas per datacenter where each replica ends up on a different host. This gives you a total of 4 replicas and for this, the `size` must be set to 4. The default is 1. | ||
_ `subFailureDomain`: Name of the CRUSH bucket representing a sub-failure domain. In a stretched configuration this option represent the "last" bucket where replicas will end up being written. Imagine the cluster is stretched across two datacenters, you can then have 2 copies per datacenter and each copy on a different CRUSH bucket. The default is "host". | ||
- `erasureCoded`: Settings for an erasure-coded pool. If specified, `replicated` settings must not be specified. See below for more details on [erasure coding](#erasure-coding). |
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.
That local preview is working for you?
9358397
to
036024d
Compare
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. However, it allows creating custom linting plugins. Create 2 such linting plugins to check 2 things: - all doc lines (except code blocks) must be aligned to a 4-space boundary, without exception. This ensures that markdown will render correctly with mkdocs. This unfortunately makes it possible to create lists that are internally aligned strangely. - admonitions must all follow the same format of ``` !!! header body ``` For the strange lists, this is allowed and renders correctly, but it looks strange: ```md - first bullet - second bullet still second bullet - third bullet has a paragraph of text inside - last bullet Signed-off-by: Blaine Gardner <blaine.gardner@ibm.com>
036024d
to
c9d99e0
Compare
ci: use markdownlint to enforce mkdocs compatibility (backport #14114)
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. However, it allows creating custom
linting plugins. Create 2 such linting plugins to check 2 things:
boundary, without exception. This ensures that markdown will render
correctly with mkdocs. This unfortunately makes it possible to create
lists that are internally aligned strangely.
For the strange lists, this is allowed and renders correctly, but it
looks strange:
Checklist: