code: function remarkSwagger (spec, opts) {
    opts = opts || {}
  
    assert.equal(typeof opts, 'object', 'opts is an object')
  
    const title = opts.title || 'API'
    const position = opts.position || 4
  
    if (opts.yaml) spec = yaml.parse(spec)
    if (opts.json) spec = JSON.parse(spec)
  
    assert.equal(typeof spec, 'object', 'spec is object')
  
    return function attacher () {
      return function transformer (ast, file) {
        const table = createTable(spec)
        const heading = u('heading', { depth: 2 }, [
          u('text', { value: title })
        ])
  
        const head = ast.children[position]
        if (head.type === 'header' && head.children[0].value === title) {
          // inject code into existing node
          ast.children[position + 1] = table
        } else {
          // inject code into new node
          ast.children.splice(position, 0, table)
          ast.children.splice(position, 0, heading)
        }
      }
    }
  }
docs: Insert a swagger specification into a markdown file (str, obj) -> (fn, obj) -> null