Skip to content

Commit

Permalink
enhance: child type should be token type
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Jan 25, 2025
1 parent 73a1d6d commit 909d689
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -659,20 +659,21 @@ function generate(tokens) {
/** @type {Array<any>} */
const lineTokens = (
tokens
.map(([type, value]) => (
{
.map(([type, value]) => {
const tokenType = TokenTypes[type]
return {
type: 'element',
tagName: 'span',
children: [{
type, // token type
type: tokenType, // token type
value: value, // to encode
}],
properties: {
className: `sh__token--${TokenTypes[type]}`,
style: { color: `var(--sh-${TokenTypes[type]})` },
className: `sh__token--${tokenType}`,
style: { color: `var(--sh-${tokenType})` },
},
}
))
})
)
lines.push(createLine(lineTokens))
}
Expand Down

0 comments on commit 909d689

Please sign in to comment.