diff options
Diffstat (limited to 'node_modules/prismjs/plugins/custom-class/prism-custom-class.js')
| -rw-r--r-- | node_modules/prismjs/plugins/custom-class/prism-custom-class.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/node_modules/prismjs/plugins/custom-class/prism-custom-class.js b/node_modules/prismjs/plugins/custom-class/prism-custom-class.js new file mode 100644 index 00000000..bb5bd6a6 --- /dev/null +++ b/node_modules/prismjs/plugins/custom-class/prism-custom-class.js @@ -0,0 +1,31 @@ +(function(){ + +if ( + (typeof self === 'undefined' || !self.Prism) && + (typeof global === 'undefined' || !global.Prism) +) { + return; +} + +var options = { + classMap: {} +}; +Prism.plugins.customClass = { + map: function map(cm) { + options.classMap = cm; + }, + prefix: function prefix(string) { + options.prefixString = string; + } +} + +Prism.hooks.add('wrap', function (env) { + if (!options.classMap && !options.prefixString) { + return; + } + env.classes = env.classes.map(function(c) { + return (options.prefixString || '') + (options.classMap[c] || c); + }); +}); + +})(); |
