Sha256: d03f648a6f9fdc3c577ae60c85f174e3ab18ca4f8d7f5052f16c7079e70eca7d

Contents?: true

Size: 1.03 KB

Versions: 23

Compression:

Stored size: 1.03 KB

Contents

'use strict'

// A line containing no characters, or a line containing only spaces (U+0020) or
// tabs (U+0009), is called a blank line.
// See <https://spec.commonmark.org/0.29/#blank-line>.
var reBlankLine = /^[ \t]*(\n|$)/

// Note that though blank lines play a special role in lists to determine
// whether the list is tight or loose
// (<https://spec.commonmark.org/0.29/#blank-lines>), it’s done by the list
// tokenizer and this blank line tokenizer does not have to be responsible for
// that.
// Therefore, configs such as `blankLine.notInList` do not have to be set here.
module.exports = blankLine

function blankLine(eat, value, silent) {
  var match
  var subvalue = ''
  var index = 0
  var length = value.length

  while (index < length) {
    match = reBlankLine.exec(value.slice(index))

    if (match == null) {
      break
    }

    index += match[0].length
    subvalue += match[0]
  }

  if (subvalue === '') {
    return
  }

  /* istanbul ignore if - never used (yet) */
  if (silent) {
    return true
  }

  eat(subvalue)
}

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
trusty-cms-5.0.7 node_modules/remark-parse/lib/tokenize/blank-line.js
trusty-cms-5.0.6 node_modules/remark-parse/lib/tokenize/blank-line.js
trusty-cms-5.0.5 node_modules/remark-parse/lib/tokenize/blank-line.js
trusty-cms-5.0.4 node_modules/remark-parse/lib/tokenize/blank-line.js
trusty-cms-5.0.3 node_modules/remark-parse/lib/tokenize/blank-line.js
trusty-cms-5.0.2 node_modules/remark-parse/lib/tokenize/blank-line.js
trusty-cms-5.0.1 node_modules/remark-parse/lib/tokenize/blank-line.js
trusty-cms-4.3.5 node_modules/remark-parse/lib/tokenize/blank-line.js
trusty-cms-5.0.0 node_modules/remark-parse/lib/tokenize/blank-line.js
trusty-cms-4.3.4 node_modules/remark-parse/lib/tokenize/blank-line.js
trusty-cms-4.3.3 node_modules/remark-parse/lib/tokenize/blank-line.js
trusty-cms-4.3.2 node_modules/remark-parse/lib/tokenize/blank-line.js
trusty-cms-4.3.1 node_modules/remark-parse/lib/tokenize/blank-line.js
trusty-cms-4.3 node_modules/remark-parse/lib/tokenize/blank-line.js
trusty-cms-4.2.3 node_modules/remark-parse/lib/tokenize/blank-line.js
trusty-cms-4.2.2 node_modules/remark-parse/lib/tokenize/blank-line.js
trusty-cms-4.2.1 node_modules/remark-parse/lib/tokenize/blank-line.js
trusty-cms-4.2 node_modules/remark-parse/lib/tokenize/blank-line.js
trusty-cms-4.1.9 node_modules/remark-parse/lib/tokenize/blank-line.js
trusty-cms-4.1.8 node_modules/remark-parse/lib/tokenize/blank-line.js