CoolFace
Apppublic

AK-21/Graphite-Industrial-Intelligence

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
format-code-as-indented.js23 linesDownload Raw Back to util
1/**2 * @import {State} from 'mdast-util-to-markdown'3 * @import {Code} from 'mdast'4 */5 6/**7 * @param {Code} node8 * @param {State} state9 * @returns {boolean}10 */11export function formatCodeAsIndented(node, state) {12  return Boolean(13    state.options.fences === false &&14      node.value &&15      // If there’s no info…16      !node.lang &&17      // And there’s a non-whitespace character…18      /[^ \r\n]/.test(node.value) &&19      // And the value doesn’t start or end in a blank…20      !/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(node.value)21  )22}23