main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
550 bytes
|
Line | |
---|
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 | }());
|
---|
Note:
See
TracBrowser
for help on using the repository browser.