UNPKG

ts-markdown-builder

Version:
28 lines 749 B
export function joinBlocks(blocks) { blocks = typeof blocks === 'string' ? [blocks] : blocks; return blocks.map(trimBlock).filter(Boolean).join('\n\n'); } function trimBlock(block) { return block.replace(/^\n+|\n+$/g, ''); } export function prefixLines(text, prefix) { const lines = text.split('\n'); return lines.map(line => `${prefix}${line}`).join('\n'); } export function escape(text) { return text.replace(/([\\`*_{}[\]()#+\-.!|<>])/g, '\\$1'); } export function maxBackticks(text) { let max = 0; let current = 0; for (let i = 0; i < text.length; i++) { if (text[i] === '`') { current++; max = Math.max(max, current); } else { current = 0; } } return max; } //# sourceMappingURL=utils.mjs.map