jonschlinkert / parse-comments

Parse JavaScript code comments. Works with block and line comments, and should work with CSS, LESS, SASS, or any language with the same comment formats.
https://github.com/jonschlinkert
MIT License
66 stars 23 forks source link

`@option` gets ignored #4

Closed mightyiam closed 9 years ago

mightyiam commented 9 years ago

The result markdown doesn't seem to mention the included @option:

'use strict'

var _ = require('lodash')
var clone = require('udc')
var xtend = require('xtend')

/**
 * Gives birth to instances
 *
 * ```js
 * var History = require('object-history')
 * var initial = {foo: 'bar', name: 'victoria'}
 * var history = new History(initial)
 * ```
 *
 * @param {Object} `initial` The initial history point
 * @param {Object} `options`
 *   @option `limit` [options] Optional. Remember this many backward points
 * @constructor
 * @api public
 */

var History = function (initial, options) {
  var self = this
  self.options = xtend({
    limit: null
  }, options)

  self.notObjError = new Error('requires a plain object')
  if (!initial || !_.isPlainObject(initial)) {
    throw self.notObjError
  }

  self.current = clone(initial)
  self.changesets = {
    backward: [],
    forward: []
  }
}

History.prototype.add = require('./prototype/add')
History.prototype.get = require('./prototype/get')
History.prototype.lengthBackward = require('./prototype/length-backward')
History.prototype.lengthForward = require('./prototype/length-forward')
History.prototype.backward = require('./prototype/backward')
History.prototype.forward = require('./prototype/forward')
History.prototype.move = require('./prototype/move')
History.prototype.forgetAllInDirection = require('./prototype/forget-all-in-direction')
History.prototype.forgetAllBackward = require('./prototype/forget-all-backward')
History.prototype.forgetAllForward = require('./prototype/forget-all-forward')

module.exports = History
jonschlinkert commented 9 years ago

it's pretty strict, since the type is missing it won't be recognized as a parameter (option). e.g.:

// looks like it's probably {Number}
@option {Number} `limit` [options] Optional. Remember this many backward points
mightyiam commented 9 years ago

Still getting ignored.

jonschlinkert commented 9 years ago

hmm, maybe I broke it in the release this morning. or maybe I fixed it and didn't push it up yet. lol either way, sorry about that

tunnckoCore commented 9 years ago

@jonschlinkert nope, just @mightyiam ordering is wrong.

try

/**
 * @param {Object} `initial` The initial history point
 * @param {Object} `options`
 *   @option [options] `limit` Optional. Remember this many backward points
 * @constructor
 * @api public
 */

[options] before backticks limit that's because the regex here L126

mightyiam commented 9 years ago

@tunnckoCore thank you.

jonschlinkert commented 9 years ago

good catch, I had to look at it twice to confirm. thanks!