backstage/mkdocs-monorepo-plugin¶
Note: This plugin is in beta. Whilst it is not expected to significantly change in functionality, it may not yet be fully compatible with other Mkdocs configuration and thus may break with some advanced configurations. Once these have been resolved and all bugs have been ironed out, we will move this to a stable release.
✚ This plugin enables you to build multiple sets of documentation in a single Mkdocs. It is designed to address writing documentation in Spotify's largest and most business-critical codebases (typically monoliths or monorepos).
✏️ Blog Post | 🐍 Python Package | ✚ Demo | 📕 Docs
Features¶
-
Support for multiple
docs/
folders in Mkdocs. Having a singledocs/
folder in a large codebase is hard to maintain. Who owns which documentation? What code is it associated with? Bringing docs closer to the associated code enables you to update them better, as well as leverage folder-based features such as GitHub Codeowners. -
Support for multiple navigations. In Spotify, large repositories typically are split up by multiple owners. These are split by folders. By introducing multiple
mkdocs.yml
files along with multipledocs/
folder, each team can take ownership of their own navigation. This plugin then intelligently merges of the documentation together into a single repository. -
Support across multiple repositories. Using Git Submodules it is possible to merge documentation across multiple repositories into a single codebase dynamically.
-
The same great Mkdocs developer experience. It is possible to run
mkdocs serve
in the root to merge all of your documentation together, or in a subfolder to build specific documentation. Autoreload still works as usual. No more using symlinks!
Install¶
It's easy to get started using PyPI and pip
using Python:
$ pip install mkdocs-monorepo-plugin
Usage¶
Take a look at our sample project or do the following:
- In the root, add the
monorepo
to yourplugins
key inmkdocs.yml
- Create a subfolder, with a
mkdocs.yml
with asite_name
andnav
, as well as adocs/
folder with anindex.md
- Back in in the root
mkdocs.yml
, use the!include
syntax in yournav
to link to to a subfoldermkdocs.yml
Example root /mkdocs.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
Example submodule /v1/mkdocs.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
Example submodule /v2/mkdocs.yml
1 2 3 4 5 6 7 8 9 10 11 12 |
|
An example filetree when using the Mkdocs Monorepo plugin looks like this:
$ tree .
├── docs
│ ├── authentication.md
│ └── index.md
├── mkdocs.yml
├── v1
│ ├── docs
│ │ ├── changelog.md
│ │ └── reference.md
│ └── mkdocs.yml
└── v2
├── docs
│ ├── changelog.md
│ ├── migrating.md
│ └── reference.md
└── mkdocs.yml
5 directories, 10 files
Supported Versions¶
- Python 3 — 3.7, 3.8, 3.9, 3.10, 3.11
- Mkdocs 1.0.4 and above.
License¶
Released under the Apache 2.0 License. See here for more details.
Contributing¶
Check out our CONTRIBUTING for more details.
Extra Reading¶
- mkdocs on GitHub
- Mkdocs documentation
- This was built using the mkdocs-plugin-template