You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://github.com/d-chris/jinja2_pdoc)
[`jinja2`](https://www.pypi.org/project/jinja2) extension based on [`pdoc`](https://pypi.org/project/pdoc/) to embedd python code directly from modules or files into your `jinja` template.
16
+
17
+
Lazy loading of `docstrings`, `code` and `functions` directly from python modules into your `jinja2 template`.
18
+
19
+
## Installation
20
+
21
+
```cmd
22
+
pip install jinja2_pdoc
23
+
```
24
+
25
+
## Example
26
+
27
+
Create a markdown file with `docstrings` and `source code` from `pathlib.Path` using `jinja2` with `jinja2_pdoc` extension.
To render all template files from `docs` using `.pre-commit-config.yaml` add the following.
64
+
65
+
You may add a `frontmatter` section at the beginning of in your templates to specify output directory and filename, e.g. `<!--filename: example.md-->`. If no metadata are at the beginning of the template, the rendered file is written to the `output` directory which is default the current working direktory.
66
+
67
+
```yaml
68
+
{{ ".pre-commit-sample.yaml" | include }}
69
+
```
70
+
71
+
Use [`additional_dependencies`](https://pre-commit.com/#config-additional_dependencies) to add extra dependencies to the pre-commit environment.
72
+
73
+
> This is necessary when a module or source code rendered into your template contains modules that are not part of the standard library.
74
+
75
+
## pre-commit-hooks
76
+
77
+
**Per default the hook is not registered to `files`!**
0 commit comments