test

-- CODE language-js --
function formatCode(el) {
   // find our magic declaration string. if we don't find it,
   // do nothing
   let match = el.innerHTML.match(/--\s*CODE\s+(.*)\s*--/),
       classNames, codeEl;
       console.log("match:", match);
 console.log("match 1:", match[1]);
   if (match && match[1]) {
     classNames = match[1];
   } else {
     return;
   }
   // strip off the magic string, everything preceding it, and
   // all leading and trailing whitespace
   let txt = el.innerHTML.substring(match.index+match[0].length);
   el.innerHTML = '';
   if (classNames.match(/language-markup/)) {
     codeEl = el.appendChild(document.createElement('script'));
     codeEl.type = 'text/plain';
   } else {
     codeEl = el.appendChild(document.createElement('pre')).
                 appendChild(document.createElement('code'));
   }
   codeEl.className = classNames;
   codeEl.innerHTML = txt;
 }

 let snips = $('p:contains("CODE")');
 snips.toArray().forEach(formatCode);
 window.Prism.highlightAll();

Recent Posts

Product

Have a chat with your Operations Toolkit

Product

(re)Introducing Abbot - a Copilot for Customer-Facing Teams

Engineering

That Shouldn't Happen - UnreachableException in .NET 7

Product

Automated Escalations with Abbot

Company

Seriously SOC 2 Compliant