MKDocs plugin for rendering swagger & openapi files.
Slowing down. Last release over 2 years ago, little activity since. Fine for existing code; think twice for a new project.
pip install mkdocs-render-swagger-pluginmkdocs-render-swagger-plugin
This is the Mkdocs plugin for rendering swagger & openapi schemas using Swagger UI. It is written in Python.
Usage
Install the plugin using pip install mkdocs-render-swagger-plugin.
Add the following lines to your mkdocs.yml:
plugins:
- render_swagger
Example
Here's an example (courtesy of Scarf) of how the plugin renders swagger.
Referencing a local json
Place an OpenAPI json file in the same folder as the .md file.
Enter !!swagger FILENAME!! at the appropriate location inside the markdown file.
If you wish to reference any files on the filesytem (security risk), make sure
you enable allow_arbitrary_locations in the config (mkdocs.yml) like so:
plugins:
- render_swagger:
allow_arbitrary_locations : true
Referencing an external json
You may reference an external OpenAPI json using the following syntax: !!swagger-http URL!!.
Explicit declaration of the Swagger JS library
You can explicitly specify the swagger-ui css and js dependencies if you wish to not use the unpkg CDN.
To specify this use javascript and css in your mkdocs.yaml:
plugins:
- render_swagger:
javascript: assets/js/swagger-ui-bundle.js
css: assets/css/swagger-ui.css
Disclaimer: This plugin is unofficial, and is not sponsored, owned or endorsed by mkdocs, swagger, or any other 3rd party.
Credits to @aviramha for starting this project.