Swagger is a framework for describing, producing, consuming, and visualizing RESTful web APIs. It includes the Swagger Specification and a set of tools. Swagger UI is a web tool that dynamically generate documentation from API definition file in Swagger Spec.
This plugin integrates Swagger UI into Jekyll site. API document can be generated and embedded in page or post.
Download or clone swagger-ui code from Swagger GitHub project. Copy swagger-ui's dist
folder to your Jekyll site and rename to swagger-ui
.
Put swagger_ui.rb
in /_plugins/
(for Jekyll) or /plugins/
(for Octopress) directory.
Put swagger.html
in /_include
(for Jekyll) or /source/_include
(for Octopress) directory.
Include swagger.html
in <head>
section of your layout file:
<html>
<head>
...
{% include swagger.html %}
</head>
Put the JSON file which describes your API into your Jekyll site, e.g. put under /api
folder.
Use swagger
tag to embed the API document in your markdown. The parameter is the link to your API JSON file.
{% swagger /api/my-api.json %}