File tree 3 files changed +339
-325
lines changed
3 files changed +339
-325
lines changed Original file line number Diff line number Diff line change 33
33
" API"
34
34
],
35
35
"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"
37
37
}
38
38
}
Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments