Show HN: Doccmd – Run linters, formatters, etc. on code blocks in Markdown/rST (github.com)

2 points by adamtheturtle ↗ HN
I built doccmd (FOSS) to run `mypy`, `ruff`, `shellcheck`, and others against code blocks in my documentation.

It supports running arbitrary tools using simple commands such as:

``` doccmd --language=python --command="mypy" README.md ```

^^ This picks out every Python code block in `README.md` and runs `mypy` against it.

It can modify code blocks in place across directories with commands like:

``` doccmd --language=python --no-pad-file --command="ruff format" docs/ ```

of course it isn't Python only, and I also run:

``` doccmd \ --language=shell \ --language=console \ --skip-marker=shfmt --no-pad-file \ --command="shfmt --write --space-redirects --indent=4" ```

The `--skip-marker` lets me put comments in the documentation which tell `doccmd` not to run `shfmt` against particular code blocks.

0 comments

[ 0.29 ms ] story [ 13.8 ms ] thread

No comments yet.