Sha256: ae10845d38f0626c1a3167cabf1a59ce2027ced0cbeb75c35c1baa1c15a83d18

Contents?: true

Size: 932 Bytes

Versions: 23

Compression:

Stored size: 932 Bytes

Contents

'use strict'

module.exports = orderedItems

var lineFeed = '\n'
var dot = '.'

var blank = lineFeed + lineFeed

// Visit ordered list items.
//
// Starts the list with
// `node.start` and increments each following list item
// bullet by one:
//
//     2. foo
//     3. bar
//
// In `incrementListMarker: false` mode, does not increment
// each marker and stays on `node.start`:
//
//     1. foo
//     1. bar
function orderedItems(node) {
  var self = this
  var fn = self.visitors.listItem
  var increment = self.options.incrementListMarker
  var values = []
  var start = node.start
  var children = node.children
  var length = children.length
  var index = -1
  var bullet

  start = start == null ? 1 : start

  while (++index < length) {
    bullet = (increment ? start + index : start) + dot
    values[index] = fn.call(self, children[index], node, index, bullet)
  }

  return values.join(node.spread ? blank : lineFeed)
}

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
trusty-cms-5.0.7 node_modules/remark-stringify/lib/macro/ordered-items.js
trusty-cms-5.0.6 node_modules/remark-stringify/lib/macro/ordered-items.js
trusty-cms-5.0.5 node_modules/remark-stringify/lib/macro/ordered-items.js
trusty-cms-5.0.4 node_modules/remark-stringify/lib/macro/ordered-items.js
trusty-cms-5.0.3 node_modules/remark-stringify/lib/macro/ordered-items.js
trusty-cms-5.0.2 node_modules/remark-stringify/lib/macro/ordered-items.js
trusty-cms-5.0.1 node_modules/remark-stringify/lib/macro/ordered-items.js
trusty-cms-4.3.5 node_modules/remark-stringify/lib/macro/ordered-items.js
trusty-cms-5.0.0 node_modules/remark-stringify/lib/macro/ordered-items.js
trusty-cms-4.3.4 node_modules/remark-stringify/lib/macro/ordered-items.js
trusty-cms-4.3.3 node_modules/remark-stringify/lib/macro/ordered-items.js
trusty-cms-4.3.2 node_modules/remark-stringify/lib/macro/ordered-items.js
trusty-cms-4.3.1 node_modules/remark-stringify/lib/macro/ordered-items.js
trusty-cms-4.3 node_modules/remark-stringify/lib/macro/ordered-items.js
trusty-cms-4.2.3 node_modules/remark-stringify/lib/macro/ordered-items.js
trusty-cms-4.2.2 node_modules/remark-stringify/lib/macro/ordered-items.js
trusty-cms-4.2.1 node_modules/remark-stringify/lib/macro/ordered-items.js
trusty-cms-4.2 node_modules/remark-stringify/lib/macro/ordered-items.js
trusty-cms-4.1.9 node_modules/remark-stringify/lib/macro/ordered-items.js
trusty-cms-4.1.8 node_modules/remark-stringify/lib/macro/ordered-items.js