From 74791642c126529f2cfb21bc6e26f5e61057afa2 Mon Sep 17 00:00:00 2001 From: strawberry Date: Wed, 3 Jul 2024 03:32:18 -0400 Subject: [PATCH] add markdownlint and run lychee in documentation CI workflow Signed-off-by: strawberry --- .editorconfig | 7 ++++++- .github/workflows/documentation.yml | 5 +++++ .markdownlintignore | 1 + CONTRIBUTING.md | 2 ++ engage.toml | 10 ++++++++++ flake.nix | 3 +++ 6 files changed, 27 insertions(+), 1 deletion(-) create mode 120000 .markdownlintignore diff --git a/.editorconfig b/.editorconfig index dba82b95..cea657e2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,5 +11,10 @@ indent_style = space insert_final_newline = true max_line_length = 120 +[*.{md,txt}] +indent_style = space +indent_size = 4 +max_line_length = 80 + [*.nix] -indent_size = 2 \ No newline at end of file +indent_size = 2 diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 9beb5064..ed0e898d 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -106,6 +106,11 @@ jobs: run: | bin/nix-build-and-cache ci + - name: Run lychee and markdownlint + run: | + direnv exec . engage just lints lychee + direnv exec . engage just lints markdownlint + - name: Build documentation (book) run: | ./bin/nix-build-and-cache just .#book diff --git a/.markdownlintignore b/.markdownlintignore new file mode 120000 index 00000000..3e4e48b0 --- /dev/null +++ b/.markdownlintignore @@ -0,0 +1 @@ +.gitignore \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d6e23912..d8bbe1fc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -37,6 +37,7 @@ The following binaries are used in [`engage.toml`][engage.toml]: - [`cargo-audit`][cargo-audit] - [`cargo-deb`][cargo-deb] - [`lychee`][lychee] +- [`markdownlint-cli`][markdownlint-cli] ### Matrix tests @@ -86,6 +87,7 @@ By sending a pull request or patch, you are agreeing that your changes are allow [sytest]: https://github.com/matrix-org/sytest/ [cargo-deb]: https://github.com/kornelski/cargo-deb [lychee]: https://github.com/lycheeverse/lychee +[markdownlint-cli]: https://github.com/igorshubovych/markdownlint-cli [cargo-audit]: https://github.com/RustSec/rustsec/tree/main/cargo-audit [direnv]: https://direnv.net/ [mdbook]: https://rust-lang.github.io/mdBook/ diff --git a/engage.toml b/engage.toml index 41c4a649..d63d822d 100644 --- a/engage.toml +++ b/engage.toml @@ -55,6 +55,11 @@ name = "lychee" group = "versions" script = "lychee --version" +[[task]] +name = "markdownlint" +group = "versions" +script = "markdownlint --version" + [[task]] name = "cargo-audit" group = "security" @@ -138,6 +143,11 @@ name = "lychee" group = "lints" script = "lychee --verbose --offline docs *.md --exclude development.md" +[[task]] +name = "markdownlint" +group = "lints" +script = "markdownlint docs *.md" + [[task]] name = "cargo/all" group = "tests" diff --git a/flake.nix b/flake.nix index b9249daa..499d828d 100644 --- a/flake.nix +++ b/flake.nix @@ -108,6 +108,9 @@ # Needed for finding broken markdown links lychee + # Needed for linting markdown files + markdownlint-cli + # Useful for editing the book locally mdbook ])