Add markdown linting tools and scripts

- Create package.json to manage markdownlint-cli2 as a dev dependency.
- Add PowerShell script for linting Markdown files with options for fixing issues.
- Update shell script to prefer locally installed markdownlint-cli2 or fallback to npx.
This commit is contained in:
HueByte
2026-07-16 20:22:57 +02:00
parent ca3c1ec2b5
commit 53927b130c
6 changed files with 1455 additions and 5 deletions
+7 -4
View File
@@ -2,6 +2,8 @@
#
# Lint all Markdown files in the repository.
# Config, globs, and ignores are defined in .markdownlint-cli2.jsonc.
# The linter version is pinned in package.json — run `npm install` once,
# or just use `npm run lint:md` / `npm run lint:md:fix` directly.
#
# Usage:
# ./scripts/lint-markdown.sh # check
@@ -12,11 +14,12 @@ set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$REPO_ROOT"
# Resolve markdownlint-cli2 binary
if command -v markdownlint-cli2 &>/dev/null; then
LINT_CMD="markdownlint-cli2"
# Prefer the locally installed (version-pinned) linter; fall back to a one-off
# npx install of the same version pinned in package.json.
if [ -x "node_modules/.bin/markdownlint-cli2" ]; then
LINT_CMD="npx --no-install markdownlint-cli2"
else
LINT_CMD="npx --yes markdownlint-cli2"
LINT_CMD="npx --yes markdownlint-cli2@0.23.0"
fi
echo "Linting Markdown files..."