mkpatcher
mkpatcher is a Python-Markdown extension allowing arbitrary scripts to modify MkDocs input files.
Table of Contents
Installation
-
pip install mkpatcher -
Include the extension in your
mkdocs.ymlconfig file:... markdown_extensions: ... - mkpatcher: ...
Usage
This extension works as a pre-processor and will allow modifying the raw lines of Markdown before any other extension runs.
Raw script
The script option takes arbitrary Python code and will provide the Markdown lines as a variable named lines.
You can modify the lines directly:
...
markdown_extensions:
...
- mkpatcher:
script: |
lines.extend(('', 'some footer', ''))
or you can shadow the variable:
...
markdown_extensions:
...
- mkpatcher:
script: |
lines = ['entirely', 'new']
lines.append('markdown')
Scripts on filesystem
The location option takes a path to either a single Python file or a directory containing multiple Python files.
If the location refers to a directory, the scripts will be loaded and eventually executed in lexicographical order
based on file names.
...
markdown_extensions:
...
- mkpatcher:
location: docs/.scripts
Each script must define a callable object named patch that accepts a single parameter which will be the Markdown lines.
You can modify the lines directly:
def patch(lines):
lines.extend(('', 'some footer', ''))
or you can return new lines:
def patch(lines):
new_lines = ['entirely', 'new']
new_lines.append('markdown')
return new_lines
License
mkpatcher is distributed under the terms of both
at your option.
Metadata
Release files for mkpatcher 1.0.2
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 |
|---|---|---|---|---|
| mkpatcher-1.0.2.tar.gz | 8.5 kB | Without provenance | Details for mkpatcher-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mkpatcher-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for mkpatcher-1.0.2-py3-none-any.whl |
Total release size: 17.1 kB
Release files / mkpatcher-1.0.2.tar.gz
| Download URL | mkpatcher-1.0.2.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c431dd5ac03ccc84a7f866178170af2c97e465547b34a3f8d0fca9a400fffb56
|
|
BLAKE2b-256 checksum How to use checksums |
102a1786c9d4d55c2fc96793f665b1a6bb479e0158c327daaf19244e0fd6886c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1
|
Release files / mkpatcher-1.0.2-py3-none-any.whl
| Download URL | mkpatcher-1.0.2-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b485475611b2b622a73e586e6f94d11c0e3861403f4d6580b95dc4fcf7861b7e
|
|
BLAKE2b-256 checksum How to use checksums |
56a84a3966cb57c62ad2ab01fe1c8396219184c6fc0537cf5adb30ed3d0b5575
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1
|
Security for mkpatcher 1.0.2
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.