install.fairie/.config/taskfiles/lint/Taskfile-markdown.yml

67 lines
2.2 KiB
YAML
Raw Normal View History

2022-12-24 12:04:59 -08:00
---
version: '3'
tasks:
markdown:
deps:
- :install:modules:local
- :install:npm:remark
desc: Lint markdown files with `remark`
summary: |
# Lint markdown files
This task uses `remark-lint` under the hood to provide markdown style recommendations.
**Example scanning all markdown files:**
`task lint:markdown`
**Example scanning single markdown file:**
`task lint:markdown -- TEST.md`
For more information on `remark`, see the [GitHub page](https://github.com/remarkjs/remark).
For more information on `remark-lint`, see the [GitHub page](https://github.com/remarkjs/remark-lint).
log:
error: Error running `remark`
start: Filtering markdown files with `remark`
success: Successfully filtered markdown files with `remark`
cmds:
- |
{{if .CLI_ARGS}}
remark {{.CLI_ARGS}}
{{else}}
while read PATHH; do
remark --no-stdout "$PATHH" &
done < <(find . -type d \( {{.IGNORE_FOLDERS}} \) -prune -o -type f \( -name '*.md' \))
wait
{{end}}
markdown:links:
deps:
- :install:npm:markdown-link-check
desc: Scan markdown files for broken links
summary: |
# Report any broken links in the files that end with .md
This task uses the npm package called `markdown-link-check` to scan all the links
and then report which ones are broken.
**Example scanning the whole project:**
`task lint:markdown-broken-links`
**Example scanning single file:**
`task lint:markdown-broken-links -- filename.md`
For more information on `markdown-link-check`, see their [GitHub page](https://github.com/tcort/markdown-link-check).
log:
error: Errors reported by `markdown-link-check`
start: Checking for broken links in markdown files with `markdown-link-check`
success: Successfully passed `markdown-link-check`
cmds:
- |
{{if .CLI_ARGS}}
markdown-link-check {{.CLI_ARGS}}
{{else}}
find . -type d \( {{.IGNORE_FOLDERS}} \) -prune -o -type f \( -name '*.md' \) -print0 | xargs -0 -r -n1 markdown-link-check
{{end}}