MCPcopy Create free account
hub / github.com/microsoft/Webwright / extractCodeFences

Function extractCodeFences

assets/compare_trajectory/app.js:360–373  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

358}
359
360function extractCodeFences(text) {
361 const fences = [];
362 const regex = /(^|\n)(`{3,})([^\n]*)\n([\s\S]*?)\n\2(?=\n|$)/g;
363 let match = regex.exec(text);
364 while (match) {
365 fences.push({
366 fence: match[2],
367 language: (match[3] || '').trim(),
368 content: match[4]
369 });
370 match = regex.exec(text);
371 }
372 return fences;
373}
374
375function normalizeCodeLanguage(language) {
376 const value = String(language || '').trim().toLowerCase();

Callers 2

extractPythonBlocksFunction · 0.85
parseSessionToolSectionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected