From 2a7f79f14d21fddb27d11f932c9cdf8677b684e7 Mon Sep 17 00:00:00 2001 From: curbengh <43627182+curbengh@users.noreply.github.com> Date: Sun, 4 Aug 2019 14:22:45 +0930 Subject: [PATCH] fix: prevent firstLine being parsed as a string --- lib/highlight.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/highlight.js b/lib/highlight.js index d3a4a0bd..106f222d 100644 --- a/lib/highlight.js +++ b/lib/highlight.js @@ -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 += `${firstLine + i}
`; - content += formatLine(line, firstLine + i, mark, options); + numbers += `${Number(firstLine) + i}
`; + content += formatLine(line, Number(firstLine) + i, mark, options); } let result = `
`;