A plugin to load swagger document for docsify.
- Add the following script in your
index.html
after docsify
<script src="//unpkg.com/docsify-swagger/dist/docsify-swagger.min.js"></script>
- Then add a swagger json url into your markdown
[swagger](http://petstore.swagger.io/v2/swagger.json)
- It's recommended to add each swagger into a seprated markdown file, and add them in
_sidebar.md
. Check the example for more details.
This plugin provides some options:
window.$docsify = {
swagger: {
cache: true,
tableWidth: "auto",
i18n: {
"en": {
request: "Request parameters",
response: "Response parameters",
name: "Name",
type: "Type",
required: "Required",
description: "Description",
none: "None"
},
fallback: "en"
}
}
}
Should cache the docs or not, the plugin will show cached document when loading failed, default is true
.
Set the width of parameters table, default is auto
.
Set the i18n for the document. The plugin has two built-in lang, en
and zh-cn
. It will try to load the fallback i18n if not found. The default fallback
is en
.
MIT License
Copyright (C) 2020 Vincent Cheung
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.