INNER CODE UNIT · JavaScript

transformOutsideFences

tradingview/lightweight-charts · website/plugins/docs-markdown/index.js:310

function transformOutsideFences(body, transform, transformBlock) {
	const fence = new RegExp(FENCED_BLOCK.source, 'gm');
	let result = '';
	let lastIndex = 0;
	let match = fence.exec(body);
	while (match !== null) {
		result += transform(body.slice(lastIndex, match.index));
		result += transformBlock === undefined ? match[0] : transformBlock(match[0]);
		lastIndex = fence.lastIndex;
		match = fence.exec(body);
	}
	return result + transform(body.slice(lastIndex));
}

const MDX_REMOVE_WHOLE = new Set(['mdxjsEsm', 'mdxFlowExpression', 'mdxTextExpression']);
const MDX_JSX = new Set(['mdxJsxFlowElement', 'mdxJsxTextElement']);

/**

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…