Skip to content

Commit

Permalink
3.1.1 port of OAI#4040
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfhandl committed Aug 29, 2024
1 parent d7eb0d4 commit 58067fb
Show file tree
Hide file tree
Showing 3 changed files with 339 additions and 325 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
"API"
],
"scripts": {
"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"
"format-markdown": "bash ./scripts/format-markdown.sh ./versions/3.1.1.md"
}
}
15 changes: 15 additions & 0 deletions scripts/format-markdown.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

SRCDIR="$(dirname "${BASH_SOURCE[0]}")" # check on Windows

for filename in $*; do
# mostly to format code blocks with examples, unfortunately messes up bullet lists and tables
npx prettier --write --single-quote $filename

# repair the tables: remove superfluos spaces and dashes that make diffing revisions harder
# and sed -i is not portable, so we need to use a temporary file
sed -E -e "s/ +\|/ |/g" -e "s/\| +/| /g" -e "s/-----+/----/g" $filename > $filename.tmp && mv $filename.tmp $filename

# repair the bullet lists and various other markdown formatting issues
npx --yes markdownlint-cli --fix --config $SRCDIR/../.markdownlint.yaml $filename
done
Loading

0 comments on commit 58067fb

Please sign in to comment.