From a0490b4c47ed44fa814a1aff8b3b60f30a7f7409 Mon Sep 17 00:00:00 2001 From: its-miroma <136986257+its-miroma@users.noreply.github.com> Date: Sun, 12 May 2024 15:56:06 +0200 Subject: [PATCH 1/6] Add GitHub workflow for `markdownlint` --- .github/workflows/markdownlint.yml | 51 ++++++++++++++++++++++++++++++ .markdownlint-cli2.yaml | 44 ++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 .github/workflows/markdownlint.yml create mode 100644 .markdownlint-cli2.yaml diff --git a/.github/workflows/markdownlint.yml b/.github/workflows/markdownlint.yml new file mode 100644 index 000000000..189fb2aac --- /dev/null +++ b/.github/workflows/markdownlint.yml @@ -0,0 +1,51 @@ +name: Run markdownlint + +on: + pull_request: + branches: + - main + paths: + - '**/*.md' + - '!translated/**' + - '!versions/**' + workflow_dispatch: # Manual run + +concurrency: + group: markdownlint-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + markdownlint: + runs-on: ubuntu-latest + + steps: + - id: checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - id: changes + uses: tj-actions/changed-files@v44 + with: + files: | + **/*.md + !translated/** + !versions/** + + - id: node + if: steps.changes.outputs.any_changed == 'true' + uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + continue-on-error: true # lint even without `titlecase` + + - id: titlecase + if: steps.node.outcome == 'success' + run: npm install markdownlint-rule-titlecase + + - id: lint + if: steps.changes.outputs.any_changed == 'true' + uses: DavidAnson/markdownlint-cli2-action@v16 + with: + config: .markdownlint-cli2.yaml + globs: ${{ steps.changes.outputs.all_changed_files }} diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml new file mode 100644 index 000000000..e1f941a07 --- /dev/null +++ b/.markdownlint-cli2.yaml @@ -0,0 +1,44 @@ +# Available configuration options: +config: + MD003: + style: atx + MD004: + style: dash + MD007: + indent: 2 + MD009: + br_spaces: 0 + MD013: false + MD024: + siblings_only: true + MD025: + front_matter_title: "" + MD026: + punctuation: ".,;:。,;:" + MD029: + style: ordered + MD035: + style: --- + MD044: + names: + - CurseForge + - Fabric + - GitHub + - Java + - Minecraft + - Modrinth + - Mojang + code_blocks: false + MD046: + style: fenced + MD048: + style: backtick + MD049: + style: underscore + MD050: + style: asterisk + MD053: false + MD055: + style: leading_and_trailing +customRules: + - markdownlint-rule-titlecase From 30e82f036178d94f762bfbfe30761773534ba5b4 Mon Sep 17 00:00:00 2001 From: its-miroma <136986257+its-miroma@users.noreply.github.com> Date: Sun, 12 May 2024 21:17:39 +0200 Subject: [PATCH 2/6] Add `MD054` rule --- .markdownlint-cli2.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml index e1f941a07..5c89b1ce7 100644 --- a/.markdownlint-cli2.yaml +++ b/.markdownlint-cli2.yaml @@ -1,4 +1,4 @@ -# Available configuration options: +# Available configuration options: https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md config: MD003: style: atx @@ -14,6 +14,7 @@ config: MD025: front_matter_title: "" MD026: + # Allow headings to end with `!` punctuation: ".,;:。,;:" MD029: style: ordered @@ -38,6 +39,12 @@ config: MD050: style: asterisk MD053: false + MD054: + # these link styles are not easily localizable + collapsed: false # A link to [keyword][]. + shortcut: false # A link to [keyword]. + # [keyword]: + url_inline: false MD055: style: leading_and_trailing customRules: From ed40322c25cea38432cb950ceebaae4d96a4fca5 Mon Sep 17 00:00:00 2001 From: its-miroma <136986257+its-miroma@users.noreply.github.com> Date: Sun, 12 May 2024 22:32:37 +0200 Subject: [PATCH 3/6] Add version numbers --- .github/workflows/markdownlint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/markdownlint.yml b/.github/workflows/markdownlint.yml index 189fb2aac..5e0b2836a 100644 --- a/.github/workflows/markdownlint.yml +++ b/.github/workflows/markdownlint.yml @@ -16,7 +16,7 @@ concurrency: jobs: markdownlint: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - id: checkout @@ -41,7 +41,7 @@ jobs: - id: titlecase if: steps.node.outcome == 'success' - run: npm install markdownlint-rule-titlecase + run: npm install markdownlint-rule-titlecase@v0.1.0 - id: lint if: steps.changes.outputs.any_changed == 'true' From 4db6189f2473ba09799135992fa87ca28fcc2438 Mon Sep 17 00:00:00 2001 From: Miroma <136986257+its-miroma@users.noreply.github.com> Date: Wed, 12 Jun 2024 17:24:11 +0200 Subject: [PATCH 4/6] Simplify logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Only exclude `ŧranslated` files - Only lint with `markdownlint-rule-titlecase` --- .github/workflows/markdownlint.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/markdownlint.yml b/.github/workflows/markdownlint.yml index 5e0b2836a..0d179af0d 100644 --- a/.github/workflows/markdownlint.yml +++ b/.github/workflows/markdownlint.yml @@ -7,7 +7,7 @@ on: paths: - '**/*.md' - '!translated/**' - - '!versions/**' + - '!versions/*/translated/**' workflow_dispatch: # Manual run concurrency: @@ -30,21 +30,18 @@ jobs: files: | **/*.md !translated/** - !versions/** + !versions/*/translated/** - id: node if: steps.changes.outputs.any_changed == 'true' uses: actions/setup-node@v4 with: node-version-file: .nvmrc - continue-on-error: true # lint even without `titlecase` - id: titlecase - if: steps.node.outcome == 'success' run: npm install markdownlint-rule-titlecase@v0.1.0 - id: lint - if: steps.changes.outputs.any_changed == 'true' uses: DavidAnson/markdownlint-cli2-action@v16 with: config: .markdownlint-cli2.yaml From 8509e4a3127f9b000f2ddae1eef7dd2c58ea46bb Mon Sep 17 00:00:00 2001 From: Miroma <136986257+its-miroma@users.noreply.github.com> Date: Thu, 13 Jun 2024 17:53:19 +0200 Subject: [PATCH 5/6] Lint all files, not only changed files --- .github/workflows/markdownlint.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/markdownlint.yml b/.github/workflows/markdownlint.yml index 0d179af0d..c7a4c10d2 100644 --- a/.github/workflows/markdownlint.yml +++ b/.github/workflows/markdownlint.yml @@ -24,16 +24,7 @@ jobs: with: fetch-depth: 0 - - id: changes - uses: tj-actions/changed-files@v44 - with: - files: | - **/*.md - !translated/** - !versions/*/translated/** - - id: node - if: steps.changes.outputs.any_changed == 'true' uses: actions/setup-node@v4 with: node-version-file: .nvmrc @@ -45,4 +36,7 @@ jobs: uses: DavidAnson/markdownlint-cli2-action@v16 with: config: .markdownlint-cli2.yaml - globs: ${{ steps.changes.outputs.all_changed_files }} + globs: | + **/*.md + !translated/** + !versions/*/translated/** From 768d001db33823d8902d50ee334e55e5adf58a2c Mon Sep 17 00:00:00 2001 From: Miroma <136986257+its-miroma@users.noreply.github.com> Date: Fri, 14 Jun 2024 23:50:48 +0200 Subject: [PATCH 6/6] Allow all HTML elements --- .markdownlint-cli2.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml index 5c89b1ce7..b975b5f38 100644 --- a/.markdownlint-cli2.yaml +++ b/.markdownlint-cli2.yaml @@ -18,6 +18,7 @@ config: punctuation: ".,;:。,;:" MD029: style: ordered + MD033: false MD035: style: --- MD044: