File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727 " API"
2828 ],
2929 "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"
3131 }
3232}
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