16 lines
369 B
TypeScript
16 lines
369 B
TypeScript
|
import { Node } from "./html/highlighter/node";
|
||
|
|
||
|
export function render(nodes: Array<Node>): HTMLElement {
|
||
|
const p = document.createElement("pre");
|
||
|
|
||
|
for (const node of nodes) {
|
||
|
const span = document.createElement("span");
|
||
|
|
||
|
span.innerText = node.content;
|
||
|
span.style.color = node.color;
|
||
|
|
||
|
p.appendChild(span);
|
||
|
}
|
||
|
|
||
|
return p;
|
||
|
}
|