docums-simple-hooks
Define your own hooks for docums, without having to create a new package.
Setup
Install the plugin using pip:
pip install docums-simple-hooks
Next, add a python module to either the docs/ directory or the root docums directory. Then, add the plugin and hooks definition to your docums.yml:
plugins:
- search
- docums-simple-hooks:
hooks:
hook-name: "your.module:hook_function"
If you have no
pluginsentry in your config file yet, you'll likely also want to add thesearchplugin. Docums enables it by default if there is nopluginsentry set.
More information about plugins in the Docums documentation.
Usage
You can use this plugin to create simple hooks for docums without having to create
a separate plugin package.
Just define a function and register it as a hook in the docums.yml. The function shall
have the same API as the desired hook. To see available hooks and their API, see the
events chapter in the docums documentation.
Example
Let's say you want to copy the README.md file to docs/index.md. To do that, create
a new file, e.g.: docs/hooks.py, and put the following function there:
import shutil
def copy_readme(*args, **kwargs):
shutil.copy("README.md", "docs/index.md")
Now, register the hook in your docums.yml:
plugins:
- docums-simple-hooks:
hooks:
on_pre_build: "docs.hooks:copy_readme"
That's all - the copy_readme() function will run every time, before building the documentation.
Disabling the plugin
You can use the enabled option to optionally disable this plugin. A possible use case is local development where you might want faster build times. It's recommended to use this option with an environment variable together with a default fallback (introduced in docums v1.2.0, see docs). Example:
plugins:
- docums-simple-hooks:
enabled: !ENV [ENABLE_DOCUMS_SIMPLE_HOOKS, True]
hooks:
on_pre_build: "docs.hooks:copy_readme"
Which enables you to disable the plugin locally using:
export ENABLE_DOCUMS_SIMPLE_HOOKS=false
docums serve
Metadata
Release files for docums-simple-hooks 0.1.5
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 | |
|---|---|---|---|---|
| docums-simple-hooks-0.1.5.tar.gz | 4.2 kB | Without provenance | Details |
Release files / docums-simple-hooks-0.1.5.tar.gz
| Download URL | docums-simple-hooks-0.1.5.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3dd85100cbcd19d55da4c7eca6ce618d2b670342a068542b175f6bfd3a3892c5
|
|
BLAKE2b-256 checksum How to use checksums |
b19c5d3fb8ee9de46dcb7430f3f2127237edb4ef61a54fa808cbb305895f138a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.4
|
Security for docums-simple-hooks 0.1.5
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.