1.1.0 • Published 8 years ago

remark-swagger v1.1.0

Weekly downloads
6
License
MIT
Repository
github
Last release
8 years ago

remark-swagger stability

npm version build status test coverage downloads js-standard-style

Insert a swagger specification into a markdown file.

Installation

$ npm install remark-swagger

Example output

Usage

const swagger = require('remark-swagger')
const remark = require('remark')
const fs = require('fs')

const spec = fs.readFileSync('./swagger-spec.json')
const readme = fs.readFileSync('./README.md')

const res = remark()
  .use(swagger(spec, { position: 3, title: 'API' }))
  .process(readme)

process.stdout.write(res, '\n')

CLI

Usage: remark-swagger [options] <markdown> [swagger]

Options:
  -h, --help        Output usage information
  -v, --version     Output version number
  -y, --yaml        Use swagger YAML instead of JSON
  -p, --position    Heading position, defaults to 4
  -t, --title       Heading title, defaults to API
  -w, --write       Persist changes to markdown file

Examples:
  $ remark-swagger README.md swagger.json    # Inject swagger into markdown
  $ remark-swagger README.md < swagger.json  # Inject swagger into markdown

Docs: https://github.com/yoshuawuyts/remark-swagger
Bugs: https://github.com/yoshuawuyts/remark-swagger/issues

API

remarkSwagger

  • opts.yaml: parse a yaml string
  • opts.json: parse a JSON string
  • opts.position: header position to insert the table. Defaults to 3
  • opts.title: header title for the table. Defaults to 'API'.

See Also

License

MIT