Skip to content

Commit

Permalink
Correct calculation for number of lines (manual merge, fix #385)
Browse files Browse the repository at this point in the history
  • Loading branch information
Golmote committed Aug 17, 2015
1 parent ee463e8 commit 14f3f80
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions plugins/line-numbers/prism-line-numbers.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ Prism.hooks.add('complete', function (env) {
pre.className += ' line-numbers';
}

var linesNum = (1 + env.code.split('\n').length);
var linesNum = env.code.match(/\n(?!$)/g).length + 1;
var lineNumbersWrapper;

var lines = new Array(linesNum);
var lines = new Array(linesNum + 1);
lines = lines.join('<span></span>');

lineNumbersWrapper = document.createElement('span');
Expand Down
2 changes: 1 addition & 1 deletion plugins/line-numbers/prism-line-numbers.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 14f3f80

Please sign in to comment.