Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,31 +32,29 @@ function highlightUtil(str, options = {}) { | |
|
||
if (!wrap) return `<pre><code class="${classNames}">${data.value}</code></pre>`; | ||
|
||
const lines = data.value.split('\n'); | ||
let numbers = ''; | ||
let content = ''; | ||
|
||
for (let i = 0, len = lines.length; i < len; i++) { | ||
let line = lines[i]; | ||
if (tab) line = replaceTabs(line, tab); | ||
numbers += `<span class="line">${Number(firstLine) + i}</span><br>`; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
SukkaW
Member
|
||
content += formatLine(line, Number(firstLine) + i, mark, options); | ||
} | ||
|
||
let result = `<figure class="highlight${data.language ? ` ${data.language}` : ''}">`; | ||
|
||
if (caption) { | ||
result += `<figcaption>${caption}</figcaption>`; | ||
} | ||
|
||
result += '<table><tr>'; | ||
result += '<table>'; | ||
|
||
if (gutter) { | ||
result += `<td class="gutter"><pre>${numbers}</pre></td>`; | ||
const lines = data.value.split('\n'); | ||
|
||
for (let i = 0, len = lines.length; i < len; i++) { | ||
let line = lines[i]; | ||
if (tab) line = replaceTabs(line, tab); | ||
let content = formatLine(line, Number(firstLine) + i, mark, options); | ||
|
||
result += '<tr>'; | ||
if (gutter) { | ||
result += `<td class="gutter"><pre><span class="line">${Number(firstLine) + i}</span></pre></td>`; | ||
} | ||
result += `<td class="code">${before}${content}${after}</td></tr>`; | ||
} | ||
|
||
result += `<td class="code">${before}${content}${after}</td>`; | ||
result += '</tr></table></figure>'; | ||
result += '</table></figure>'; | ||
|
||
return result; | ||
} | ||
|
@@ -71,7 +69,6 @@ function formatLine(line, lineno, marked, options) { | |
res += useHljs ? line : `">${line}</span>`; | ||
} | ||
|
||
res += '<br>'; | ||
return res; | ||
} | ||
|
||
|
😢 Number does not seem to render the same effect.