Skip to content

Commit 6d14f22

Browse files
committed
Add mkdocs integration documentation
1 parent c1c10cf commit 6d14f22

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<a href="https://github.com/ml-tooling/lazydocs/releases">Changelog</a>
2525
</p>
2626

27-
Lazydocs makes it easy to generate beautiful markdown documentation for your Python API (see this [example](./docs)). It provides a simple command-line interface as well as a Python API to get full-fledged API documentation within seconds based on all of the [Google-style docstrings](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html) in your code. This markdown documentation can be pushed to Github or integrated into your MkDocs site.
27+
Lazydocs makes it easy to generate beautiful markdown documentation for your Python API (see this [example](./docs)). It provides a [simple command-line interface](#cli-interface) as well as a [Python API](#programmatic-api) to get full-fledged API documentation within seconds based on all of the [Google-style docstrings](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html) in your code. This markdown documentation can be pushed to Github or integrated into your MkDocs site.
2828

2929
## Highlights
3030

@@ -104,9 +104,33 @@ lazydocs --overview-file="README.md" my_package
104104

105105
The API overview will be written as markdown to the specified file with separated lists for all modules, classes, and functions of your project:
106106

107-
### MKDocs Integration
107+
### MkDocs Integration
108108

109+
<img style="width: 100%" src="./docs/images/mkdocs-integration.png"/>
109110

111+
The markdown documentation generated by lazydocs can be easily integrated into your [mkdocs](https://www.mkdocs.org/) documentation site:
112+
113+
1. Generate the markdown documentation into a subfolder (e.g. `api-docs`) inside your mkdocs documentation. We recommend to use the `overview-file` option and set the source-code URL via `src-base-url`, otherwise the source-code linking would not work:
114+
115+
```bash
116+
lazydocs \
117+
--overview-file="README.md" \
118+
--src-base-url="https://github.com/example/my-project/blob/main/" \
119+
my_package
120+
```
121+
122+
2. Install and apply the [awesome-pages mkdocs plugin](https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin). This enables mkdocs to automatically discover and include all markdown files. The alternative would be to manually include all generated markdown files in the navigation section of the `mkdocs.yaml`. In order to use the awesome-pages plugin you need to 1) install the plugin via pip 2) Include it in the plugin section `mkdocs.yaml` and remove the navigation section (needs to be handled with `.pages` files).
123+
124+
3. Create a `.pages` file within the api-docs subfolder (e.g. `api-docs`) with the following content:
125+
126+
```yaml
127+
title: API Reference
128+
nav:
129+
- Overview: README.md
130+
- ...
131+
```
132+
133+
Once you run or deploy your mkdocs documentation, you will see the API Reference section with all the API markdown documentation.
110134
111135
### Docstyle Validation
112136

0 commit comments

Comments
 (0)