Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function highlightLineObjects(lineObjects, language) {
let code = lineObjects.map(lineObject => lineObject.text).join('\n');
let highlightedCode = highlightCode(code, language);
return highlightedCode.split('\n').map((text, index) => ({
id: lineObjects[index].id,
highlighted: lineObjects[index].highlighted,
// htmlSafe is justified here because we generated the highlighting markup
// ourself in highlightCode
text: htmlSafe(text === "" ? "\n" : text),
}));
}
function highlightLineObjects(lineObjects, language) {
let code = lineObjects.map(lineObject => lineObject.text).join('\n');
let highlightedCode = highlightCode(code, language);
return highlightedCode.split('\n').map((text, index) => ({
id: lineObjects[index].id,
highlighted: lineObjects[index].highlighted,
text: text === "" ? "\n" : text,
}));
}