A command-line utility for pulling code blocks out of markdown files.
$ pip install mkcodes
# For traditional markdown code-block support.
$ pip install mkcodes[markdown]
$ mkcodes --help
Usage: mkcodes [OPTIONS] INPUTS...
Options:
--output TEXT
--github / --markdown Github-flavored fence blocks or pure markdown.
--safe / --unsafe Allow code blocks without language hints.
--package-python Add __init__.py files to python dirs for test
discovery
--default-lang TEXT Assumed language for code blocks without language
hints.
--help Show this message and exit.
Why would I want such a thing?
My purpose is testing.
You can easily enough doctest a markdown file with python -m doctest myfile.md, but I don't like typing or looking at a whole bunch of >>> and ...'s. Also there's no way that I know of to run linters against such code blocks.
Instead, I include (pytest) functional tests in my codeblocks, extract the code blocks with this script, and then run my test runner and linters against the output files.
Running Tests
./test
Metadata
Release files for mkcodes 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mkcodes-0.2.0.tar.gz | 9.1 kB | Without provenance | Details for mkcodes-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mkcodes-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for mkcodes-0.2.0-py3-none-any.whl |
Total release size: 17.6 kB
Release files / mkcodes-0.2.0.tar.gz
| Download URL | mkcodes-0.2.0.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
340fbf47c7fccb4ceb16b874b036090d05e9f8b9355bc251e125888a3da71624
|
|
BLAKE2b-256 checksum How to use checksums |
5245ab73436ffbe517afbee7270b046ee0ee5e51ae0a39229e4a5c24b21b575d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|
Release files / mkcodes-0.2.0-py3-none-any.whl
| Download URL | mkcodes-0.2.0-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2e5a5e9200747b22a007d0d50c0f9274e6e9ecd5a7b1cdaf300ff28fdda1553d
|
|
BLAKE2b-256 checksum How to use checksums |
3856472c0e6982c5184f24812a4968b950349ea9523141749df786c4b28d1b9d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|
Security for mkcodes 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.