This repository has been archived on 2020-11-02. You can view files and clone it, but cannot push or open issues or pull requests.
TripSit_Suite/node_modules/remark-parse/lib/tokenize/blank-line.js
2020-11-01 22:46:04 +00:00

44 lines
1.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'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>), its 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)
}