Skip to content

Commit fad4f5d

Browse files
committed
Trim just first/last newline from static code. Fix #78
1 parent 8aa6eda commit fad4f5d

5 files changed

+12
-12
lines changed

angular-highlightjs.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*! angular-highlightjs
22
version: 0.6.3
3-
build date: 2017-01-04
3+
build date: 2017-02-19
44
author: Chih-Hsuan Fan
55
https://github.com/pc035860/angular-highlightjs.git */
66

@@ -296,8 +296,8 @@ hljsDir = /*@ngInject*/ ["$parse", function ($parse) {
296296
compile: function(tElm, tAttrs, transclude) {
297297
// get static code
298298
// strip the starting "new line" character
299-
var staticHTML = tElm[0].innerHTML.replace(/^(\r\n|\r|\n)/m, ''),
300-
staticText = tElm[0].textContent.replace(/^(\r\n|\r|\n)/m, '');
299+
var staticHTML = tElm[0].innerHTML.replace(/^(\r\n|\r|\n)/, ''),
300+
staticText = tElm[0].textContent.replace(/^(\r\n|\r|\n)/, '');
301301

302302
// put template
303303
tElm.html('<pre><code class="hljs"></code></pre>');

angular-highlightjs.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/angular-highlightjs.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*! angular-highlightjs
22
version: 0.6.3
3-
build date: 2017-01-04
3+
build date: 2017-02-19
44
author: Chih-Hsuan Fan
55
https://github.com/pc035860/angular-highlightjs.git */
66

@@ -296,8 +296,8 @@ hljsDir = /*@ngInject*/ ["$parse", function ($parse) {
296296
compile: function(tElm, tAttrs, transclude) {
297297
// get static code
298298
// strip the starting "new line" character
299-
var staticHTML = tElm[0].innerHTML.replace(/^(\r\n|\r|\n)/m, ''),
300-
staticText = tElm[0].textContent.replace(/^(\r\n|\r|\n)/m, '');
299+
var staticHTML = tElm[0].innerHTML.replace(/^(\r\n|\r|\n)/, ''),
300+
staticText = tElm[0].textContent.replace(/^(\r\n|\r|\n)/, '');
301301

302302
// put template
303303
tElm.html('<pre><code class="hljs"></code></pre>');

build/angular-highlightjs.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)