Skip to content

Commit c6283f0

Browse files
committed
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: * 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
1 parent 7b671a7 commit c6283f0

File tree

4 files changed

+57
-0
lines changed

4 files changed

+57
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
/.gitignore export-ignore
1010
/.github export-ignore
1111
/.markdownlint-cli2.yaml export-ignore
12+
/.remarkignore export-ignore
13+
/.remarkrc export-ignore
1214
/phpcs.xml.dist export-ignore
1315
/phpstan.neon.dist export-ignore
1416
/phpunit.xml.dist export-ignore

.github/workflows/cs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,7 @@ jobs:
146146
markdownlint:
147147
name: 'Lint Markdown'
148148
uses: PHPCSStandards/.github/.github/workflows/reusable-markdownlint.yml@main
149+
150+
remark:
151+
name: 'QA Markdown'
152+
uses: PHPCSStandards/.github/.github/workflows/reusable-remark.yml@main

.remarkignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ignore rules for Remark.
2+
# Docs: https://github.com/unifiedjs/unified-engine/blob/HEAD/doc/ignore.md
3+
4+
/node_modules/
5+
/vendor/

.remarkrc

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"plugins": [
3+
"remark-gfm",
4+
["remark-lint-checkbox-character-style", "consistent"],
5+
["remark-lint-checkbox-content-indent", "consistent"],
6+
"remark-lint-definition-spacing",
7+
"remark-lint-file-extension",
8+
["remark-lint-linebreak-style", "unix"],
9+
["remark-lint-link-title-style", "\""],
10+
["remark-lint-ordered-list-marker-style", "."],
11+
[
12+
"remark-lint-no-dead-urls",
13+
{
14+
"skipUrlPatterns": [
15+
"https://packagist.org/packages/phpcsstandards/phpcsdevtools#dev-develop"
16+
],
17+
"deadOrAliveOptions": {
18+
"maxRetries": 3
19+
}
20+
}
21+
],
22+
"remark-lint-no-duplicate-defined-urls",
23+
"remark-lint-no-duplicate-definitions",
24+
"remark-lint-no-empty-url",
25+
"remark-lint-no-file-name-consecutive-dashes",
26+
["remark-lint-no-file-name-irregular-characters", "\\.a-zA-Z0-9_-"],
27+
"remark-lint-no-file-name-outer-dashes",
28+
"remark-lint-no-heading-like-paragraph",
29+
"remark-lint-no-literal-urls",
30+
"remark-lint-no-reference-like-url",
31+
"remark-lint-no-shortcut-reference-image",
32+
"remark-lint-no-table-indentation",
33+
"remark-lint-no-undefined-references",
34+
"remark-lint-no-unneeded-full-reference-image",
35+
"remark-lint-no-unneeded-full-reference-link",
36+
"remark-lint-no-unused-definitions",
37+
["remark-lint-strikethrough-marker", "~~"],
38+
["remark-lint-table-cell-padding", "consistent"],
39+
"remark-lint-heading-whitespace",
40+
"remark-lint-list-item-punctuation",
41+
"remark-lint-match-punctuation",
42+
"remark-lint-no-hr-after-heading",
43+
"remark-lint-are-links-valid-duplicate",
44+
"remark-validate-links"
45+
]
46+
}

0 commit comments

Comments
 (0)