Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ const getIndentStr = opts => {
}

const syntaxHlStr = (lang, script, opts, indentStart) => {
let output = ''

const indentStr = getIndentStr(opts)

if (opts.$indent.tabs) {
Expand All @@ -138,17 +136,9 @@ const syntaxHlStr = (lang, script, opts, indentStart) => {
}

const code = hljs.highlight(lang, script).value
const lines = code.split('\n')

lines.forEach((line, lineNumber) => {
const html = `<code>${line}</code>`
const $body = cheerio.load(html).root().find('code')[0]
const text = filter($body, opts)
output += text
if (lineNumber !== lines.length - 1) {
output += '\n'
}
})
const html = `<code>${code}</code>`
const $body = cheerio.load(html).root().find('code')[0]
const output = filter($body, opts)

return output
}
Expand Down