This commit is contained in:
20
node_modules/mdast-util-to-markdown/lib/handle/break.js
generated
vendored
Normal file
20
node_modules/mdast-util-to-markdown/lib/handle/break.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
module.exports = hardBreak
|
||||
|
||||
var patternInScope = require('../util/pattern-in-scope')
|
||||
|
||||
function hardBreak(node, _, context, safe) {
|
||||
var index = -1
|
||||
|
||||
while (++index < context.unsafe.length) {
|
||||
// If we can’t put eols in this construct (setext headings, tables), use a
|
||||
// space instead.
|
||||
if (
|
||||
context.unsafe[index].character === '\n' &&
|
||||
patternInScope(context.stack, context.unsafe[index])
|
||||
) {
|
||||
return /[ \t]/.test(safe.before) ? '' : ' '
|
||||
}
|
||||
}
|
||||
|
||||
return '\\\n'
|
||||
}
|
||||
Reference in New Issue
Block a user