https://github.com/oprypin/mkdocs-gen-files
MkDocs plugin to programmatically generate documentation pages during the build
https://github.com/oprypin/mkdocs-gen-files
mkdocs mkdocs-plugin mkdocstrings
Last synced: 7 days ago
JSON representation
MkDocs plugin to programmatically generate documentation pages during the build
- Host: GitHub
- URL: https://github.com/oprypin/mkdocs-gen-files
- Owner: oprypin
- License: mit
- Created: 2020-12-07T21:19:53.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2025-02-15T16:34:14.000Z (about 2 months ago)
- Last Synced: 2025-04-01T08:30:24.251Z (14 days ago)
- Topics: mkdocs, mkdocs-plugin, mkdocstrings
- Language: Python
- Homepage: https://oprypin.github.io/mkdocs-gen-files
- Size: 110 KB
- Stars: 120
- Watchers: 2
- Forks: 10
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
- jimsghstars - oprypin/mkdocs-gen-files - MkDocs plugin to programmatically generate documentation pages during the build (Python)
README
# mkdocs-gen-files
**[Plugin][] for [MkDocs][] to programmatically generate documentation pages during the build**
[](https://pypi.org/project/mkdocs-gen-files/)
[](https://github.com/oprypin/mkdocs-gen-files/blob/master/LICENSE.md)
[](https://github.com/oprypin/mkdocs-gen-files/actions?query=event%3Apush+branch%3Amaster)```shell
pip install mkdocs-gen-files
```**Continue to the [documentation site][].**
[mkdocs]: https://www.mkdocs.org/
[plugin]: https://www.mkdocs.org/user-guide/plugins/
[documentation site]: https://oprypin.github.io/mkdocs-gen-files## Usage
Activate the plugin in **mkdocs.yml** (`scripts` is a required list of Python scripts to execute, always relative to **mkdocs.yml**):
```yaml
plugins:
- search
- gen-files:
scripts:
- gen_pages.py # or any other name or path
```Then create such a script **gen_pages.py** (this is relative to the root, *not* to the **docs** directory).
```python
import mkdocs_gen_fileswith mkdocs_gen_files.open("foo.md", "w") as f:
print("Hello, world!", file=f)
```This added a programmatically generated page to our site. That is, the document doesn't actually appear in our source files, it only *virtually* becomes part of the site to be built by MkDocs.
**Continue to the [documentation site][].**