Fix: markdownlint MD012/MD019 errors in build-pattern-conversion-plan.md

- Removed extra blank lines at end of file to resolve MD012 (no-multiple-blanks)
- Standardized heading spacing to resolve MD019 (no-multiple-space-atx)
- Stripped trailing whitespace and ensured file ends with a single newline

All changes maintain content integrity and bring the file into full markdownlint compliance.
This commit is contained in:
Matthew Raymer
2025-07-10 13:07:51 +00:00
parent 00cc6114da
commit 8b95cc8d2b
15 changed files with 249 additions and 198 deletions

37
scripts/format-markdown.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/usr/bin/env bash
# format-markdown.sh
# Author: Matthew Raymer
# Date: 2025-07-09
# Description: Format markdown files to comply with project markdown ruleset
set -e
if [ $# -eq 0 ]; then
echo "Usage: $0 <file-or-directory> [more files...]"
exit 1
fi
for target in "$@"; do
if [ -d "$target" ]; then
files=$(find "$target" -type f -name "*.md")
else
files="$target"
fi
for file in $files; do
# Remove trailing spaces
sed -i 's/[[:space:]]*$//' "$file"
# Remove multiple consecutive blank lines
awk 'NF{blank=0} !NF{blank++} blank<2' "$file" > "$file.tmp" && mv "$file.tmp" "$file"
# Ensure file ends with a single newline
awk '1; END{if (NR && $0!="") print ""}' "$file" > "$file.tmp" && mv "$file.tmp" "$file"
# Optionally run markdownlint (requires npx and markdownlint-cli)
if command -v npx >/dev/null 2>&1; then
npx markdownlint "$file"
else
echo "npx/markdownlint not found, skipping lint check for $file"
fi
done
done
echo "Markdown formatting complete."