Urara-Blog/node_modules/.pnpm-store/v3/files/1a/39497088fdb9ba54b32806e61e06afdb3b4082276d1b3f54181a78db470acc913cc094fa5879051d2a1fcf4a7f673569e7b21231cc9e9614f13e6a52f1a1e3
2022-08-14 01:14:53 +08:00

31 lines
763 B
Text

/**
* @typedef {import('mdast').Blockquote} Blockquote
* @typedef {import('../types.js').Handle} Handle
* @typedef {import('../util/indent-lines.js').Map} Map
*/
import {containerFlow} from '../util/container-flow.js'
import {indentLines} from '../util/indent-lines.js'
import {track} from '../util/track.js'
/**
* @type {Handle}
* @param {Blockquote} node
*/
export function blockquote(node, _, context, safeOptions) {
const exit = context.enter('blockquote')
const tracker = track(safeOptions)
tracker.move('> ')
tracker.shift(2)
const value = indentLines(
containerFlow(node, context, tracker.current()),
map
)
exit()
return value
}
/** @type {Map} */
function map(line, _, blank) {
return '>' + (blank ? '' : ' ') + line
}