Skip to content
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

HDDS-11970. Ignore markdown code blocks in cspell #118

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ Docusaurus provides many options for laying out documentation pages and their me

#### Spelling

The file names and content of all markdown pages are checked for spelling mistakes using [cspell](https://cspell.org/) as part of GitHub actions. Spelling can also be checked locally by running the script [.github/scripts/spelling.sh](.github/scripts/spelling.sh). This requires you to have pnpm's dev dependencies installed on your machine for cspell to work (run `pnpm install --dev`).
As part of the GitHub Actions CI, all markdown pages will be checked for spelling mistakes using [cspell](https://cspell.org/). Markdown code blocks are excluded from spelling checks. Spelling can also be checked locally by running the script [.github/scripts/spelling.sh](.github/scripts/spelling.sh). This requires you to have pnpm's dev dependencies installed on your machine for cspell to work (run `pnpm install --dev`).

**If spell check fails for words that are correct but not recognized:**

Expand Down
20 changes: 20 additions & 0 deletions cspell.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,26 @@ import:
- "@cspell/dict-shell/cspell-ext.json"
- "@cspell/dict-docker/cspell-ext.json"

languageSettings:
- languageId:
- markdown
- mdx
ignoreRegExpList:
- markdown_code_block
- markdown_inline_code

patterns:
- name: markdown_code_block
pattern: |
/
^(\s*`{3,}).* # match the ```
[\s\S]*? # the block of code
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between [\s\S] and .?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the pattern provided by the cspell docs that I copied here and tested out. ChatGPT says . will not match newlines and [\s\S] is a workaround to catch multi-line code blocks. However, when I tested it locally, . also seemed to work for multiple lines.

^\1 # end of the block
/gmx
- name: markdown_inline_code
pattern: |
`[^`]*`

flagWords:
# Write "quasi-closed" instead of "quasi closed".
- quasi
Expand Down
6 changes: 0 additions & 6 deletions docs/08-developer-guide/04-project/02-release-guide.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
---
sidebar_label: Release Manager Guide

# Custom words specific to this page:
# cSpell:ignore protoroot codesigningkey lockdir pinentry gpgconf orgapacheozone

# On this page, ignore CLI options used with -D or -P.
# cSpell:ignoreRegExp -(D|P)[a-z\.,]+([\s]|=)
---

# Apache Release Manager Guide
Expand Down
Loading