Skip to content

Commit

Permalink
Merge pull request #67 from curbengh/line-number
Browse files Browse the repository at this point in the history
fix: prevent firstLine being parsed as a string
  • Loading branch information
curbengh committed Aug 7, 2019
2 parents 491851d + 2a7f79f commit ab30d63
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/highlight.js
Expand Up @@ -36,8 +36,8 @@ function highlightUtil(str, options = {}) {
for (let i = 0, len = lines.length; i < len; i++) {
let line = lines[i];
if (tab) line = replaceTabs(line, tab);
numbers += `<span class="line">${firstLine + i}</span><br>`;
content += formatLine(line, firstLine + i, mark, options);
numbers += `<span class="line">${Number(firstLine) + i}</span><br>`;
content += formatLine(line, Number(firstLine) + i, mark, options);
}

let result = `<figure class="highlight${data.language ? ` ${data.language}` : ''}">`;
Expand Down

0 comments on commit ab30d63

Please sign in to comment.