Skip to content

Commit 59f905d

Browse files
committed
Fix for the last line if empty
1 parent 352a5ba commit 59f905d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

dist/highlightjs-line-numbers.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/highlightjs-line-numbers.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@
8282

8383
var lines = getLines(inputHtml);
8484

85+
// if last line contains only carriage return remove it
86+
if (lines[lines.length-1].trim() === '') {
87+
lines.pop();
88+
}
89+
8590
if (lines.length > firstLineIndex) {
8691
var html = '';
8792

0 commit comments

Comments
 (0)