From 26105034da4fcce7ac883c899d781f016559310d Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 8 Nov 2018 00:38:48 +0800 Subject: switch to vuepress --- .../plugins/custom-class/prism-custom-class.js | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 node_modules/prismjs/plugins/custom-class/prism-custom-class.js (limited to 'node_modules/prismjs/plugins/custom-class/prism-custom-class.js') 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); + }); +}); + +})(); -- cgit v1.2.3