Urara-Blog/node_modules/.pnpm-store/v3/files/13/bf9b4ddd2a7984268dc177cab85f2af19a1b9e3b8846098efddb8bc3a65e6672086abc3e8ec2dc09ede8e675efece0672f0260446fd56ae1ded807a57ffef0
2022-08-14 01:14:53 +08:00

22 lines
579 B
Text
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.

/**
* @typedef {import('mdast').Code} Code
* @typedef {import('../types.js').Context} Context
*/
/**
* @param {Code} node
* @param {Context} context
* @returns {boolean}
*/
export function formatCodeAsIndented(node, context) {
return Boolean(
!context.options.fences &&
node.value &&
// If theres no info…
!node.lang &&
// And theres a non-whitespace character…
/[^ \r\n]/.test(node.value) &&
// And the value doesnt start or end in a blank…
!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(node.value)
)
}