MKDocs plugin for rendering swagger & openapi files.
Project description
mkdocs-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
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.
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.
Keep in mind, the filename has to be swagger-ui.css
for the CSS and swagger-ui-bundle.js
for the JS.
To specify this use extra_javascript
and extra_css
in your mkdocs.yaml:
extra_javascript:
- assets/js/swagger-ui-bundle.js
extra_css:
- assets/css/swagger-ui.css
Contributing & Developing Locally
After downloading and extracting the .tar.gz
, install this package locally using pip
and the --editable
flag:
pip install --editable .
You'll then have the render-swagger
package available to use in Mkdocs and pip
will point the dependency to this folder. You are then able to run the docs using mkdocs serve
. Make sure you restart the process between code changes as the plugin is loaded on startup.
MkDocs plugins and Swagger api
The Render Swagger MkDocs plugin uses a set of extensions and plugin APIs that MkDocs and Swagger UI supports. You can find more info about MkDocs plugins and Swagger UI on the official website of MkDocs and SwaggerUI.
The input OpenAPI files processed by the plugin should conform to the OpenAPI specification. It is generated by a few projects such as pydantic, FastAPI and others.
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mkdocs-render-swagger-plugin-0.0.4.tar.gz
.
File metadata
- Download URL: mkdocs-render-swagger-plugin-0.0.4.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d7880076de624640d6f9e2bf4689a484db0597d43c5d6cd1b2ccad0dfe469c2 |
|
MD5 | 99657b7c6bee7a136eb44da8b7d0bd07 |
|
BLAKE2b-256 | e43f5f4f762f96c72b85baa9ce319331b88515f11c7c0a01aeeff2d8c61e4e31 |
File details
Details for the file mkdocs_render_swagger_plugin-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: mkdocs_render_swagger_plugin-0.0.4-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5936889a0405947ff5c9e2b5c4393fe26dbd3dd1e2d03ec8a38ff826ee105866 |
|
MD5 | 1f7b8a7aeb962b6d301bb8d9e8186655 |
|
BLAKE2b-256 | 3b586d67cc36f32c8a12c67e5716a4498463a5ab2b3627b8063ec6758b96fdf9 |