🎉 initiate project *astro_rewrite*
This commit is contained in:
parent
ffd4d5e86c
commit
2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions
32
node_modules/mdast-util-to-markdown/lib/handle/break.js
generated
vendored
Normal file
32
node_modules/mdast-util-to-markdown/lib/handle/break.js
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* @typedef {import('mdast').Break} Break
|
||||
* @typedef {import('../types.js').Parent} Parent
|
||||
* @typedef {import('../types.js').State} State
|
||||
* @typedef {import('../types.js').Info} Info
|
||||
*/
|
||||
|
||||
import {patternInScope} from '../util/pattern-in-scope.js'
|
||||
|
||||
/**
|
||||
* @param {Break} _
|
||||
* @param {Parent | undefined} _1
|
||||
* @param {State} state
|
||||
* @param {Info} info
|
||||
* @returns {string}
|
||||
*/
|
||||
export function hardBreak(_, _1, state, info) {
|
||||
let index = -1
|
||||
|
||||
while (++index < state.unsafe.length) {
|
||||
// If we can’t put eols in this construct (setext headings, tables), use a
|
||||
// space instead.
|
||||
if (
|
||||
state.unsafe[index].character === '\n' &&
|
||||
patternInScope(state.stack, state.unsafe[index])
|
||||
) {
|
||||
return /[ \t]/.test(info.before) ? '' : ' '
|
||||
}
|
||||
}
|
||||
|
||||
return '\\\n'
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue