File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 27
27
" API"
28
28
],
29
29
"scripts" : {
30
- "format-markdown" : " npx prettier --write --single-quote versions/3.0.4.md && sed -i '' -E -e 's/ + \\ |/ |/g' -e 's/ \\ | +/| /g' -e 's/-----+/----/g' versions/3.0.4.md && npx --yes markdownlint-cli --fix --config .markdownlint.yaml versions/3.0.4.md"
30
+ "format-markdown" : " bash ./scripts/format-markdown.sh ./ versions/3.0.4.md"
31
31
}
32
32
}
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ for filename in $* ; do
4
+ # mostly to format code blocks with examples, unfortunately messes up bullet lists and tables
5
+ npx prettier --write --single-quote $filename
6
+
7
+ # repair the tables: remove superfluos spaces and dashes that make diffing revisions harder
8
+ # and sed -i is not portable, so we need to use a temporary file
9
+ sed -E -e " s/ +\|/ |/g" -e " s/\| +/| /g" -e " s/-----+/----/g" $filename > $filename .tmp && mv $filename .tmp $filename
10
+
11
+ # repair the bullet lists and various other markdown formatting issues
12
+ npx --yes markdownlint-cli --fix --config .markdownlint.yaml $filename
13
+ done
You can’t perform that action at this time.
0 commit comments