Skip to content

Commit 366e637

Browse files
Add a note about linting (#3045)
1 parent ccae3d6 commit 366e637

1 file changed

Lines changed: 28 additions & 2 deletions

File tree

README.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,32 @@ The most common failures are:
5252
- A new image is referenced with the wrong path
5353
- An internal link has a bad address
5454

55+
### Markdown linting
56+
57+
Markdown files are linted in CI using [markdownlint](https://github.com/DavidAnson/markdownlint). The rules are configured in `.markdownlint.json`.
58+
59+
To catch issues locally, install the [markdownlint VS Code extension](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint) (already included in the recommended extensions). It will highlight errors on save.
60+
61+
You can also run the linter from the command line using [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2):
62+
63+
```bash
64+
npx markdownlint-cli2 "src/pages/**/*.{md,mdx}"
65+
```
66+
67+
To lint only files changed in the current branch (matching the CI behavior):
68+
69+
```bash
70+
git diff origin/main --name-only --diff-filter=ACMRTUXB -- '*.md' '*.mdx' | xargs npx markdownlint-cli2
71+
```
72+
73+
Or in PowerShell:
74+
75+
```powershell
76+
git diff origin/main --name-only --diff-filter=ACMRTUXB -- '*.md' '*.mdx' | ForEach-Object { npx markdownlint-cli2 $_ }
77+
```
78+
79+
Common issues include missing blank lines around headings, fenced code blocks without a language, duplicate headings, and trailing whitespace.
80+
5581
### Spell check
5682

5783
You can run the spell check locally using:
@@ -86,7 +112,7 @@ Before merging to `main` it's possible you'd like to see your changes in a previ
86112

87113
You can generate a static copy of the site using `pnpm build` and run it in a browser with `pnpm preview`.
88114

89-
Note! We use _Sharp_ to generate images. You may need to install a specific flavour of _Sharp_ depending on your operating system. If you see an error, such as "Error: Could not load the "sharp" module using the linux-x64 runtime", you can follow the instruction on the [Sharp cross-platform page](https://sharp.pixelplumbing.com/install#cross-platform). You can also refer to [issue 2142](https://github.com/OctopusDeploy/docs/issues/2142).
115+
Note! We use *Sharp* to generate images. You may need to install a specific flavour of *Sharp* depending on your operating system. If you see an error, such as "Error: Could not load the "sharp" module using the linux-x64 runtime", you can follow the instruction on the [Sharp cross-platform page](https://sharp.pixelplumbing.com/install#cross-platform). You can also refer to [issue 2142](https://github.com/OctopusDeploy/docs/issues/2142).
90116

91117
## Astro hints and tips
92118

@@ -205,7 +231,7 @@ MDX files don't allow short-form links, instead of using `<https://example.com>`
205231

206232
### Title icons
207233

208-
If you are updating a page in Docs which doesn't already have a title icon, please add one. Title icons can be added in the frontmatter for each page by adding a Font Awesome class in the `icon` entry:
234+
If you are updating a page in Docs which doesn't already have a title icon, please add one. Title icons can be added in the frontmatter for each page by adding a Font Awesome class in the `icon` entry:
209235

210236
```yaml
211237
---

0 commit comments

Comments
 (0)