Skip to content

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented May 14, 2025

GH Actions: add new check for consistency in markdown files

This new check uses the NPM MarkdownLint package via the NPM MarkdownLint-CLI2 package.

It executes a loose check for consistency and some common errors.
Some of the more annoying rules/rules which could impact display of markdown files on GitHub have been disabled.

All necessary configuration is contained in the .markdownlint-cli2.yaml file.

To run locally, install via:

npm install -g markdownlint-cli2

... and then run via:

markdownlint-cli2

Includes a problem matcher in the reusable workflow, which should allow for displaying the results inline in GitHub PR code review view.

Includes adding the config file to .gitattributes.
Includes adding node_modules to the .gitignore in case anyone would install these tools locally (to prevent them committing them).

Refs:

Docs: tweak markdown for compliance with markdownlint

GH Actions: add new check with additional QA for markdown files

While MarkdownLint is absolutely great for finding formatting issues, Remark offers some additional "rules" which are useful, such as checking that links and link definitions match up, verifying all used links work and some additional formatting checks which markdownlint just doesn't offer.

An extensive effort has been made to prevent duplication of messages between the Markdownlint and the Remark check. This includes ensuring there are no conflicting rules.

The rule configuration is contained in the .remarkrc file.

Files/directories to be ignored can be listed in the .remarkignore file which supports glob syntax, like .gitignore.
Note: .-prefixed files and directories are excluded by default. To include those in the scan, they have to be passed explicitly on the command-line.

Refs:

Additional (external) plugins included:

Docs: fix various links

GH Actions: add Yamllint to QA basics

... to loosely safeguard valid and consistent yaml files.

Includes adding a configuration file which loosens up the default ruleset to a degree I'm comfortable with.

Ref: https://yamllint.readthedocs.io/

Yaml: various tweaks for compliance with Yamllint and actionlint

jrfnl added 6 commits May 14, 2025 10:06
This new check uses the NPM MarkdownLint package via the NPM MarkdownLint-CLI2 package.

It executes a loose check for consistency and some common errors.
Some of the more annoying rules/rules which could impact display of markdown files on GitHub have been disabled.

All necessary configuration is contained in the `.markdownlint-cli2.yaml` file.

To run locally, install via:
```bash
npm install -g markdownlint-cli2
```
... and then run via:
```bash
markdownlint-cli2
```

Includes a problem matcher in the reusable workflow, which _should_ allow for displaying the results inline in GitHub PR code review view.

Includes adding the config file to `.gitattributes`.
Includes adding `node_modules` to the `.gitignore` in case anyone would install these tools locally (to prevent them committing them).

Refs:
* https://github.com/DavidAnson/markdownlint
* https://github.com/DavidAnson/markdownlint-cli2
While MarkdownLint is absolutely great for finding formatting issues, Remark offers some additional "rules" which are useful, such as checking that links and link definitions match up, verifying all used links work and some additional formatting checks which markdownlint just doesn't offer.

An extensive effort has been made to prevent duplication of messages between the Markdownlint and the Remark check. This includes ensuring there are no conflicting rules.

The rule configuration is contained in the `.remarkrc` file.

Files/directories to be ignored can be listed in the `.remarkignore` file which supports glob syntax, like `.gitignore`.
Note: `.`-prefixed files and directories are excluded by default. To include those in the scan, they have to be passed explicitly on the command-line.

Refs:
* https://github.com/remarkjs/remark/tree/main/packages/remark-cli
* https://github.com/remarkjs/remark-lint
* https://github.com/remarkjs/remark-gfm
* https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-consistent
* https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-recommended
* https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide

Additional (external) plugins included:
* https://github.com/vhf/remark-lint-heading-whitespace
* https://github.com/wemake-services/remark-lint-list-item-punctuation
* https://github.com/laysent/remark-lint-plugins/tree/HEAD/packages/remark-lint-match-punctuation
* https://github.com/olizilla/remark-lint-no-hr-after-heading
* https://github.com/wemake-services/remark-lint-are-links-valid
* https://github.com/remarkjs/remark-validate-links
... to loosely safeguard valid and consistent yaml files.

Includes adding a configuration file which loosens up the `default` ruleset to a degree I'm comfortable with.

Ref: https://yamllint.readthedocs.io/
@jrfnl jrfnl added this to the 1.x Next milestone May 14, 2025
@jrfnl jrfnl changed the title Feature/ghactions add markdown linting GH Actions: add markdown linting and yaml linting May 14, 2025
@jrfnl jrfnl merged commit 73d7792 into stable May 14, 2025
47 checks passed
@jrfnl jrfnl deleted the feature/ghactions-add-markdown-linting branch May 14, 2025 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants