diff --git a/plugins/show-invisibles/prism-show-invisibles.js b/plugins/show-invisibles/prism-show-invisibles.js index 5d9692b4df..3c460cc894 100644 --- a/plugins/show-invisibles/prism-show-invisibles.js +++ b/plugins/show-invisibles/prism-show-invisibles.js @@ -7,13 +7,12 @@ if ( return; } -for (var language in Prism.languages) { - var tokens = Prism.languages[language]; - - tokens.tab = /\t/g; - tokens.crlf = /\r\n/g; - tokens.lf = /\n/g; - tokens.cr = /\r/g; -} +Prism.hooks.add('before-highlight', function(env) { + var tokens = env.grammar; + tokens.tab = /\t/g; + tokens.crlf = /\r\n/g; + tokens.lf = /\n/g; + tokens.cr = /\r/g; +}); })();