Socket
Book a DemoInstallSign in
Socket

remark-swagger

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-swagger

Insert a swagger specification into a markdown file

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

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

pathmethodsummary
/foo/barGETget all bars in the area
/bin/bazPUTadd a new baz to the region

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

Keywords

swagger

FAQs

Package last updated on 25 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts