diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 0000000000..c84a18ae74 --- /dev/null +++ b/Taskfile.yml @@ -0,0 +1,41 @@ +--- +version: "3" + +vars: + lit: '{' + changes: + sh: git diff --name-only master | grep '.md$' + +tasks: + md:list: + desc: "List changed .md files on PR" + cmds: + - for: + var: changes + as: change + split: "\n" + silent: true + cmd: echo {{.change}} + + md:fmt: + desc: "Run mdox fmt on changed .md files on PR" + cmds: + - for: + var: changes + as: change + split: "\n" + silent: true + cmd: | + if [ -f "{{.change}}" ]; then + echo {{.change}} + mdox fmt {{.change}} + # list item formatting + perl -pi -e 's/^\* /- /g' {{.change}} + # leading space before list (-) after colon (:) + sed -i -E ':a;N;$!ba;s/:\n-/:\n\n-/g' {{.change}} + # sanitize code block highlights from .js to js, ... + sed -i 's/```\./```/g' {{.change}} + # restore notice hugo shortcode whitespace + sed -i 's/>}} />}}\n/g' {{.change}} + sed -i 's/[[:space:]]\x7b\x7b