08-27-周三_17-09-29
This commit is contained in:
21
node_modules/prismjs/plugins/remove-initial-line-feed/prism-remove-initial-line-feed.js
generated
vendored
Normal file
21
node_modules/prismjs/plugins/remove-initial-line-feed/prism-remove-initial-line-feed.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
(function() {
|
||||
|
||||
if (typeof self === 'undefined' || !self.Prism || !self.document) {
|
||||
return;
|
||||
}
|
||||
|
||||
Prism.hooks.add('before-sanity-check', function (env) {
|
||||
if (env.code) {
|
||||
var pre = env.element.parentNode;
|
||||
var clsReg = /(?:^|\s)keep-initial-line-feed(?:\s|$)/;
|
||||
if (
|
||||
pre && pre.nodeName.toLowerCase() === 'pre' &&
|
||||
// Apply only if nor the <pre> or the <code> have the class
|
||||
(!clsReg.test(pre.className) && !clsReg.test(env.element.className))
|
||||
) {
|
||||
env.code = env.code.replace(/^(?:\r?\n|\r)/, '');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}());
|
1
node_modules/prismjs/plugins/remove-initial-line-feed/prism-remove-initial-line-feed.min.js
generated
vendored
Normal file
1
node_modules/prismjs/plugins/remove-initial-line-feed/prism-remove-initial-line-feed.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"undefined"!=typeof self&&self.Prism&&self.document&&Prism.hooks.add("before-sanity-check",function(e){if(e.code){var s=e.element.parentNode,n=/(?:^|\s)keep-initial-line-feed(?:\s|$)/;!s||"pre"!==s.nodeName.toLowerCase()||n.test(s.className)||n.test(e.element.className)||(e.code=e.code.replace(/^(?:\r?\n|\r)/,""))}});
|
Reference in New Issue
Block a user