function highlightBlock(element) {
        /** @type HTMLElement */
        let node = null;
        const language = blockLanguage(element);

        if (shouldNotHighlight(language)) return;

        fire("before:highlightBlock",
          { block: element, language: language });

        if (options.useBR) {
          node = document.createElement('div');
          node.innerHTML = element.innerHTML.replace(/\n/g, '').replace(/<br[ /]*>/g, '\n');
        } else {
          node = element;
        }
        const text = node.textContent;
        const result = language ? highlight(language, text, true) : highlightAuto(text);

        const originalStream = nodeStream$1(node);
        if (originalStream.length) {
          const resultNode = document.createElement('div');
          resultNode.innerHTML = result.value;
          result.value = mergeStreams$1(originalStream, nodeStream$1(resultNode), text);
        }
        result.value = fixMarkup(result.value);

        fire("after:highlightBlock", { block: element, result: result });

        element.innerHTML = result.value;
        element.className = buildClassName(element.className, language, result.language);
        element.result = {
          language: result.language,
          // TODO: remove with version 11.0
          re: result.relevance,
          relavance: result.relevance
        };
        if (result.second_best) {
          element.second_best = {
            language: result.second_best.language,
            // TODO: remove with version 11.0
            re: result.second_best.relevance,
            relavance: result.second_best.relevance
          };
        }
      }
/**
       * Applies highlighting to a DOM node containing code. Accepts a DOM node and
       * two optional parameters for fixMarkup.
       *
       * @param {HighlightedHTMLElement} element - the HTML element to highlight
      */
Applies highlighting to a DOM node containing code. Accepts a DOM node and
two optional parameters for fixMarkup.

@param {HighlightedHTMLElement} element - the HTML element to highlight
Applies highlighting to a DOM node containing code . Accepts a DOM node and two optional parameters for fixMarkup . @param { HighlightedHTMLElement } element - the HTML element to highlight
function highlightBlock(element) {
        let node = null;
        const language = blockLanguage(element);
        if (shouldNotHighlight(language)) return;
        fire("before:highlightBlock",
          { block: element, language: language });
        if (options.useBR) {
          node = document.createElement('div');
          node.innerHTML = element.innerHTML.replace(/\n/g, '').replace(/<br[ /]*>/g, '\n');
        } else {
          node = element;
        }
        const text = node.textContent;
        const result = language ? highlight(language, text, true) : highlightAuto(text);
        const originalStream = nodeStream$1(node);
        if (originalStream.length) {
          const resultNode = document.createElement('div');
          resultNode.innerHTML = result.value;
          result.value = mergeStreams$1(originalStream, nodeStream$1(resultNode), text);
        }
        result.value = fixMarkup(result.value);
        fire("after:highlightBlock", { block: element, result: result });
        element.innerHTML = result.value;
        element.className = buildClassName(element.className, language, result.language);
        element.result = {
          language: result.language,
          re: result.relevance,
          relavance: result.relevance
        };
        if (result.second_best) {
          element.second_best = {
            language: result.second_best.language,
            re: result.second_best.relevance,
            relavance: result.second_best.relevance
          };
        }
      }
function highlightBlock ( element ) { let node = null ; const language = blockLanguage ( element ) ; if ( shouldNotHighlight ( language ) ) return ; fire ( "before:highlightBlock" , { block : element , language : language } ) ; if ( options . useBR ) { node = document . createElement ( 'div' ) ; node . innerHTML = element . innerHTML . replace ( / \n / g , '' ) . replace ( / <br[ /]*> / g , '\n' ) ; } else { node = element ; } const text = node . textContent ; const result = language ? highlight ( language , text , true ) : highlightAuto ( text ) ; const originalStream = nodeStream$1 ( node ) ; if ( originalStream . length ) { const resultNode = document . createElement ( 'div' ) ; resultNode . innerHTML = result . value ; result . value = mergeStreams$1 ( originalStream , nodeStream$1 ( resultNode ) , text ) ; } result . value = fixMarkup ( result . value ) ; fire ( "after:highlightBlock" , { block : element , result : result } ) ; element . innerHTML = result . value ; element . className = buildClassName ( element . className , language , result . language ) ; element . result = { language : result . language , re : result . relevance , relavance : result . relevance } ; if ( result . second_best ) { element . second_best = { language : result . second_best . language , re : result . second_best . relevance , relavance : result . second_best . relevance } ; } }
Applies highlighting to a DOM node containing code.
Applies highlighting to a DOM node containing code .
/** @type HTMLElement */ // TODO: remove with version 11.0 // TODO: remove with version 11.0