Skip to content

Commit 37d5ae4

Browse files
committed
Condensed tables
1 parent 28d1910 commit 37d5ae4

File tree

3 files changed

+345
-331
lines changed

3 files changed

+345
-331
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@
3939
"API"
4040
],
4141
"scripts": {
42-
"format-markdown": "npx prettier --write --single-quote versions/3.2.0.md && npx --yes markdownlint-cli --fix --config .markdownlint.yaml versions/3.2.0.md"
42+
"format-markdown": "bash ./scripts/format-markdown.sh ./versions/3.2.0.md"
4343
}
4444
}

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)