lang/markup-templating.js
function(env, language, placeholderPattern, replaceFilter) {
          if (env.language !== language) {
            return
          }
          var tokenStack = (env.tokenStack = [])
          env.code = env.code.replace(placeholderPattern, function(match) {
            if (typeof replaceFilter === 'function' && !replaceFilter(match)) {
              return match
            }
            var i = tokenStack.length
            var placeholder
            // Check for existing strings
            while (
              env.code.indexOf((placeholder = getPlaceholder(language, i))) !==
              -1
            )
              ++i
            // Create a sparse array
            tokenStack[i] = match
            return placeholder
          })
          // Switch the grammar to markup
          env.grammar = Prism.languages.markup
        }
function(env, language, placeholderPattern, replaceFilter) {
          if (env.language !== language) {
            return
          }
          var tokenStack = (env.tokenStack = [])
          env.code = env.code.replace(placeholderPattern, function(match) {
            if (typeof replaceFilter === 'function' && !replaceFilter(match)) {
              return match
            }
            var i = tokenStack.length
            var placeholder
            // Check for existing strings
            while (
              env.code.indexOf((placeholder = getPlaceholder(language, i))) !==
              -1
            )
              ++i
            // Create a sparse array
            tokenStack[i] = match
            return placeholder
          })
          // Switch the grammar to markup
          env.grammar = Prism.languages.markup
        }
function ( env , language , placeholderPattern , replaceFilter ) { if ( env . language !== language ) { return } var tokenStack = ( env . tokenStack = [ ] ) env . code = env . code . replace ( placeholderPattern , function ( match ) { if ( typeof replaceFilter === 'function' && ! replaceFilter ( match ) ) { return match } var i = tokenStack . length var placeholder // Check for existing strings while ( env . code . indexOf ( ( placeholder = getPlaceholder ( language , i ) ) ) !== - 1 ) ++ i // Create a sparse array tokenStack [ i ] = match return placeholder } ) // Switch the grammar to markup env . grammar = Prism . languages . markup }
Tokenize all inline templating expressions matching `placeholderPattern`.

If `replaceFilter` is provided, only matches of `placeholderPattern` for which `replaceFilter` returns
`true` will be replaced.

@param {object} env The environment of the `before-tokenize` hook.
@param {string} language The language id.
@param {RegExp} placeholderPattern The matches of this pattern will be replaced by placeholders.
@param {(match: string) => boolean} [replaceFilter]
Tokenize all inline templating expressions matching placeholderPattern .