solidjs-show-code
Version:
Code viewer for solidJs
10 lines (9 loc) • 473 B
JSX
export const buildHtmlTree = (tokens, styleSheet) => {
return <pre>
{tokens.map(token => {
//check tokens first then types
const colour = styleSheet.colorKeyWordMap.find(colorMap => colorMap.tokens?.includes(token.text)) ?? styleSheet.colorKeyWordMap.find(colorMap => colorMap.types?.includes(token.type));
return colour ? <span style={{ color: colour.color }}>{token.text}</span> : token.text;
})}
</pre>;
};