Run commands against code blocks in reStructuredText and Markdown files.
Project description
doccmd
A command line tool for running commands against documentation files.
Installation
With pip
Requires Python 3.11+.
pip install doccmd
With Homebrew (macOS, Linux, WSL)
Requires Homebrew.
brew tap adamtheturtle/doccmd
brew install doccmd
Usage example
# Run mypy against the Python code blocks in README.md and CHANGELOG.rst
$ doccmd --language=python --command="mypy" README.md CHANGELOG.rst
# Run gofmt against the Go code blocks in README.md
# This will modify the README.md file in place
$ doccmd --language=go --command="gofmt -w" README.md
# or type less...
$ doccmd -l python -c mypy README.md CHANGELOG.rst
What does it work on?
reStructuredText (.rst)
.. code-block:: shell
echo "Hello, world!"
Markdown (.md)
```shell
echo "Hello, world!"
```
MyST (.md with MyST syntax)
```{code-block} shell
echo "Hello, world!"
```
Want more? Open an issue!
TODO:
Release pre-commit hook
Verbose mode… “Running command “X” against README.rst example from line …”
Option to not delete file
Document https://sybil.readthedocs.io/en/latest/rest.html#skipping-examples on docrun, and make it work
Full documentation
See the full documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
doccmd-2024.9.11.4.tar.gz
(24.4 kB
view hashes)
Built Distribution
Close
Hashes for doccmd-2024.9.11.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a723646ffee5a839b1f5325a626d4fc39c59bd0cdb7c370dc9b064d26524eab |
|
MD5 | 5baaebefe50ff7d8b88f67af3d508c50 |
|
BLAKE2b-256 | 5fb25e88aa3f8a2442f2bc5a29a28b3a4f41ee7cda7f54bdad06c9e75ea55fa6 |