Skip to content

Commit 45b8742

Browse files
authored
Merge pull request #4056 from ralfhandl/3.1.1-table-cleanup
3.1.1: tables cleanup
2 parents d7eb0d4 + 58067fb commit 45b8742

File tree

3 files changed

+339
-325
lines changed

3 files changed

+339
-325
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@
3333
"API"
3434
],
3535
"scripts": {
36-
"format-markdown": "npx prettier --write --single-quote versions/3.1.1.md && npx --yes markdownlint-cli --fix --config .markdownlint.yaml versions/3.1.1.md"
36+
"format-markdown": "bash ./scripts/format-markdown.sh ./versions/3.1.1.md"
3737
}
3838
}

scripts/format-markdown.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
SRCDIR="$(dirname "${BASH_SOURCE[0]}")" # check on Windows
4+
5+
for filename in $*; do
6+
# mostly to format code blocks with examples, unfortunately messes up bullet lists and tables
7+
npx prettier --write --single-quote $filename
8+
9+
# repair the tables: remove superfluos spaces and dashes that make diffing revisions harder
10+
# and sed -i is not portable, so we need to use a temporary file
11+
sed -E -e "s/ +\|/ |/g" -e "s/\| +/| /g" -e "s/-----+/----/g" $filename > $filename.tmp && mv $filename.tmp $filename
12+
13+
# repair the bullet lists and various other markdown formatting issues
14+
npx --yes markdownlint-cli --fix --config $SRCDIR/../.markdownlint.yaml $filename
15+
done

0 commit comments

Comments
 (0)