From b2ba95b35227472839edb3aaf910b0eccfd62f49 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 13 Oct 2024 03:42:32 +0200 Subject: [PATCH] QA: add markdown workflow and configs ... to check the code style and various other things in the markdown stored in this repo. Uses the previously created reusable workflows. --- .github/workflows/markdown.yml | 17 ++++++ .markdownlint-cli2.yaml | 100 +++++++++++++++++++++++++++++++++ .remarkignore | 4 ++ .remarkrc | 36 ++++++++++++ 4 files changed, 157 insertions(+) create mode 100644 .github/workflows/markdown.yml create mode 100644 .markdownlint-cli2.yaml create mode 100644 .remarkignore create mode 100644 .remarkrc diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml new file mode 100644 index 0000000..2c9fb2c --- /dev/null +++ b/.github/workflows/markdown.yml @@ -0,0 +1,17 @@ +name: Markdown + +on: + # Run on all pushes and on all pull requests. + push: + pull_request: + # Allow manually triggering the workflow. + workflow_dispatch: + +jobs: + markdownlint: + name: 'Lint Markdown' + uses: ./.github/workflows/reusable-markdownlint.yml + + remark: + name: 'QA Markdown' + uses: ./.github/workflows/reusable-remark.yml diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml new file mode 100644 index 0000000..8986788 --- /dev/null +++ b/.markdownlint-cli2.yaml @@ -0,0 +1,100 @@ +# +# Configuration file for MarkdownLint-CLI2. +# +# Example file with all options: +# https://github.com/DavidAnson/markdownlint-cli2/blob/main/test/markdownlint-cli2-yaml-example/.markdownlint-cli2.yaml +# + +# Do not fix any fixable errors. +fix: false + +# Define glob expressions to use (only valid at root). +globs: + - "**/*.md" + +# Show found files on stdout (only valid at root) +showFound: true + +# Define glob expressions to ignore. +ignores: + - "node_modules/" + +# Disable inline config comments. +noInlineConfig: true + +# Disable progress on stdout (only valid at root). +noProgress: false + +# Adjust the configuration for some built-in rules. +# For full information on the options and defaults, see: +# https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml +config: + ###################### + # Disable a few rules. + ###################### + # MD031/blanks-around-fences - Fenced code blocks should be surrounded by blank lines. + MD031: false + # MD032/blanks-around-lists - Lists should be surrounded by blank lines. + MD032: false + + ############################## + # Customize a few other rules. + ############################## + # MD003/heading-style/header-style - Heading style. + MD003: + # Heading style - Always use hashes. + style: "atx" + + # MD004/ul-style - Unordered list style. + MD004: + # List style - each level has a different, but consistent symbol. + style: "sublist" + + # MD007/ul-indent - Unordered list indentation. + MD007: + indent: 4 + # Whether to indent the first level of the list. + start_indented: false + + # MD012/no-multiple-blanks - Multiple consecutive blank lines. + MD012: + maximum: 2 + + # MD013/line-length - Line length. + MD013: + # Number of characters. No need for being too fussy. + line_length: 1000 + # Number of characters for headings. + heading_line_length: 100 + # Number of characters for code blocks. + code_block_line_length: 100 + # Stern length checking (applies to tables, code blocks etc which have their own max line length). + stern: true + + # MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content. + MD024: + # Only check sibling headings. + siblings_only: true + + # MD044/proper-names - Proper names should have the correct capitalization. + MD044: + # List of proper names. + names: ["PHPCSStandards"] + # Include code blocks. + code_blocks: false + + # MD046/code-block-style - Code block style + MD046: + style: "fenced" + + # MD048/code-fence-style - Code fence style + MD048: + style: "backtick" + + # MD049/emphasis-style - Emphasis style should be consistent + MD049: + style: "underscore" + + # MD050/strong-style - Strong style should be consistent + MD050: + style: "asterisk" diff --git a/.remarkignore b/.remarkignore new file mode 100644 index 0000000..2af3921 --- /dev/null +++ b/.remarkignore @@ -0,0 +1,4 @@ +# Ignore rules for Remark. +# Docs: https://github.com/unifiedjs/unified-engine/blob/HEAD/doc/ignore.md + +/node_modules/ diff --git a/.remarkrc b/.remarkrc new file mode 100644 index 0000000..26379e9 --- /dev/null +++ b/.remarkrc @@ -0,0 +1,36 @@ +{ + "plugins": [ + "remark-gfm", + ["remark-lint-checkbox-character-style", "consistent"], + ["remark-lint-checkbox-content-indent", "consistent"], + "remark-lint-definition-spacing", + "remark-lint-file-extension", + ["remark-lint-linebreak-style", "unix"], + ["remark-lint-link-title-style", "\""], + ["remark-lint-ordered-list-marker-style", "."], + "remark-lint-no-dead-urls", + "remark-lint-no-duplicate-defined-urls", + "remark-lint-no-duplicate-definitions", + "remark-lint-no-empty-url", + "remark-lint-no-file-name-consecutive-dashes", + ["remark-lint-no-file-name-irregular-characters", "\\.a-zA-Z0-9-_"], + "remark-lint-no-file-name-outer-dashes", + "remark-lint-no-heading-like-paragraph", + "remark-lint-no-literal-urls", + "remark-lint-no-reference-like-url", + "remark-lint-no-shortcut-reference-image", + "remark-lint-no-table-indentation", + "remark-lint-no-undefined-references", + "remark-lint-no-unneeded-full-reference-image", + "remark-lint-no-unneeded-full-reference-link", + "remark-lint-no-unused-definitions", + ["remark-lint-strikethrough-marker", "~~"], + ["remark-lint-table-cell-padding", "consistent"], + "remark-lint-heading-whitespace", + "remark-lint-list-item-punctuation", + "remark-lint-match-punctuation", + "remark-lint-no-hr-after-heading", + "remark-lint-are-links-valid-duplicate", + "remark-validate-links" + ] +}