Skip to content

Commit ebd4a33

Browse files
committed
Add linting information to CONTRIBUTING.md
This adds information on how the docs use linting, and more detailed instructions on how to enable it in an IDE, using VSCode as a concrete and widespread example. Additionally, to do this, we add a duplicate style config for markdownlint in JSON format for the Node.js implementation of markdownlint that is used by various editor plugins. These both implement the same core set of warnings, and appear to function identically.
1 parent 0fb1ca9 commit ebd4a33

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

.markdownlint.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"default": false,
3+
"hr-style": true,
4+
"no-missing-space-atx": true,
5+
"no-multiple-space-atx": true,
6+
"no-missing-space-closed-atx": true,
7+
"no-multiple-space-closed-atx": true,
8+
"no-space-in-emphasis": true,
9+
"no-space-in-code": true,
10+
"no-space-in-links": true,
11+
"ol-prefix": {"style": "ordered"},
12+
"no-reversed-links": true
13+
}

.mdlrc.style.rb renamed to .markdownlint.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md
2+
#
3+
# When updating rules in this file, ensure the corresponding rule list in
4+
# .markdownlint.json is also updated.
25

36
# style
47
rule 'header-style'

CONTRIBUTING.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ as possible for you to work in this repository. The documentation for Docker is
66
## Table of Contents
77

88
- [Contribution guidelines](#contribution-guidelines)
9-
- [Files not edited here](#files-not-edited-here)
109
- [Important files](#important-files)
10+
- [Files not edited here](#files-not-edited-here)
1111
- [Per-page front-matter](#per-page-front-matter)
1212
- [Pull request guidelines](#pull-request-guidelines)
1313
- [Collaborate on a pull request](#collaborate-on-a-pull-request)
@@ -192,7 +192,18 @@ repository. Compressing images after adding them to the repository actually wors
192192

193193
### Style guide
194194

195-
Docker does not currently maintain a style guide. Follow the examples set by the existing documentation and use your best judgment.
195+
Docker does not currently maintain a style guide. Follow the examples set by
196+
the existing documentation and use your best judgment.
197+
198+
We use [markdownlint](https://github.com/markdownlint/markdownlint) to ensure
199+
consistent markdown source, and to catch potential formatting issues as early
200+
as possible. While CI/CD will catch these during the PR review process, you may
201+
wish to configure your IDE to catch these while writing.
202+
203+
For VSCode, you can use the [markdownlint](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint)
204+
plugin, which will automatically detect and apply the pre-made rules in
205+
`.markdownlint.json`. This plugin also comes with auto-fix functionality, see
206+
the plugin documentation for more information.
196207

197208
## Build and preview the docs locally
198209

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ FROM gem AS mdl-base
8282
ARG MDL_JSON
8383
ARG MDL_STYLE
8484
RUN --mount=type=bind,target=. <<EOF
85-
mdl --ignore-front-matter ${MDL_JSON:+'--json'} --style=${MDL_STYLE:-'.mdlrc.style.rb'} $( \
85+
mdl --ignore-front-matter ${MDL_JSON:+'--json'} --style=${MDL_STYLE:-'.markdownlint.rb'} $( \
8686
find '.' -name '*.md' \
8787
-not -path './registry/*' \
8888
-not -path './desktop/extensions-sdk/*' \

0 commit comments

Comments
 (0)