Skip to content

Commit ab30d63

Browse files
authored
Merge pull request #67 from curbengh/line-number
fix: prevent firstLine being parsed as a string
2 parents 491851d + 2a7f79f commit ab30d63

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/highlight.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ function highlightUtil(str, options = {}) {
3636
for (let i = 0, len = lines.length; i < len; i++) {
3737
let line = lines[i];
3838
if (tab) line = replaceTabs(line, tab);
39-
numbers += `<span class="line">${firstLine + i}</span><br>`;
40-
content += formatLine(line, firstLine + i, mark, options);
39+
numbers += `<span class="line">${Number(firstLine) + i}</span><br>`;
40+
content += formatLine(line, Number(firstLine) + i, mark, options);
4141
}
4242

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

0 commit comments

Comments
 (0)