import CodeMirror from 'codemirror' ; CodeMirror . defineMode ( 'mustache' , function ( config , parserConfig ) { const mustacheOverlay = { token ( stream , _ ) { let ch ; if ( stream . match ( '{{' ) ) { while ( ( ch = stream . next ( ) ) != null ) if ( ch === '}' && stream . next ( ) === '}' ) { stream . eat ( '}' ) ; return 'mustache' ; } } while ( stream . next ( ) != null && ! stream . match ( '{{' , false ) ) { continue ; } return null ; } } ; return CodeMirror . overlayMode ( CodeMirror . getMode ( config , parserConfig . backdrop || 'text/html' ) , mustacheOverlay ) ; } ) ;