1 | (function () {
|
2 |
|
3 | if (typeof Prism === 'undefined' || typeof document === 'undefined') {
|
4 | return;
|
5 | }
|
6 |
|
7 | Prism.hooks.add('before-sanity-check', function (env) {
|
8 | if (env.code) {
|
9 | var pre = env.element.parentNode;
|
10 | var clsReg = /(?:^|\s)keep-initial-line-feed(?:\s|$)/;
|
11 | if (
|
12 | pre && pre.nodeName.toLowerCase() === 'pre' &&
|
13 | // Apply only if nor the <pre> or the <code> have the class
|
14 | (!clsReg.test(pre.className) && !clsReg.test(env.element.className))
|
15 | ) {
|
16 | env.code = env.code.replace(/^(?:\r?\n|\r)/, '');
|
17 | }
|
18 | }
|
19 | });
|
20 |
|
21 | }());
|