Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: lib/src/prism/plugins/remove-initial-line-feed/prism-remove-initial-line-feed.js

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 (function() {
2
3 if (typeof self === 'undefined' || !self.Prism || !self.document) {
4 return;
5 }
6
7 Prism.hooks.add('before-highlight', function (env) {
8 if (env.code) {
9 var pre = env.element.parentNode;
10 var clsReg = /\s*\bkeep-initial-line-feed\b\s*/;
11 if (
12 pre && pre.nodeName.toLowerCase() === 'pre' &&
13 // Apply only if nor the <pre> or the <code> have the cl ass
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 }());
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698