INNER CODE UNIT · JavaScript
match
tradingview/lightweight-charts · website/plugins/docs-markdown/index.js:292
const match = /^---\r?\n[\s\S]*?\r?\n---\r?\n?/.exec(raw);
return match ? raw.slice(match[0].length) : raw;
}
const FENCED_BLOCK = /^[ \t]*(`{3,}|~{3,})[^\n]*\n[\s\S]*?^[ \t]*\1[^\n]*$/gm;
/**
* Runs `transform` on the parts of `body` outside fenced code blocks (of any
* fence length), so code samples are never rewritten. Inline `code` spans are
* deliberately not protected: link labels are regularly written as
* ``[`method`](…)``, and treating the label as code would split it from its URL
* and leave the link unrewritten.
*
* @param {string} body
* @param {(segment: string) => string} transform
* @param {(block: string) => string} [transformBlock] Applied to each fenced block instead of keeping it verbatim.
* @returns {string}
*/