Skip to content

Create docs from an Open API Spec

Widdershins

Install

npm install -g widdershins

config

save in config.json

{
  "language_tabs": [
    {
      "python": "Python"
    },
    {
      "http": "HTTP"
    },
    {
      "shell": "Shell"
    }
  ],
  "language_clients": [
    {
      "shell": "curl"
    }
  ],
  "httpsnippet":"true",
  "resolve":"true",
  "headings":"4"
}

run

create html

widdershins --environment config.json --html <api_spec>.yaml -o index.html

create respec

widdershins --environment config.json --respec <api_spec>.yaml -o index.html

create markdown

widdershins --environment config.json <api_spec>.yaml -o index.md

reslate to create html

Get reslate

NOTE: You may wish to create a fork of this repo

 git clone git@github.com:Mermade/reslate.git

Copy your markdown file

Copy markdown file to source/index.md

change _site\slate\img\logo.png

change css if required

modify _site\slate\css\screen.css

install

npm i

Access content

npm run serve
browse to http://localhost:4567

pandoc

install pandoc

apt install pandoc

run pandoc

NOTE: When creating pdf's pandoc doesnt wrap code blocks

docx

 pandoc -o <output>.docx -f markdown -t docx <input>.md

pdf

 pandoc <input>.md -o <output>.pdf -V geometry:margin=1in