MkDocs Redoc Tag
A MkDocs plugin supports adding Redoc to the page.
Features
- OpenAPI Specification file from online over URL or static file in docs
- All dependencies are using static files handled by the plugin not from CDN, especially suitable for those documents been deployed in the intranet
- Synchronized dark mode with Material for MkDocs
Dependency
- Python Package
- beautifulsoup4>=4.11.1
- Redoc standalone javascript from official CDN
- redoc==2.1.3
Usage
-
Install the plugin from Pypi
-
Add
3. Addredoc-tag
plugin into your mkdocs.yml plugins sections:redoc
tag in markdown to include Redoc: -
You may customize the plugin by passing options in mkdocs.yml:
Options Type Description background String Default: "". Redoc iframe body background attribute value. You can use any css value for background for example "#74b9ff" or "Gainsboro" or "" for nothing. height String Default: "80vh". Height of Redoc iframe.
How it works
- Copy Redoc script file into
site/assets/javascripts/
directory - Search all redoc tags, then convert them to an iframe tag and generate the iframe target html with the given OpenAPI Specification src path
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Reference
- redark: source of dark mode javascript and css