(token: shiki.ThemedToken)
| 5 | export type HighlightedText = [string, ThemeColor | null]; |
| 6 | |
| 7 | function parseShikiColor(token: shiki.ThemedToken): ThemeColor { |
| 8 | let modifiers: ColorModifier[] | undefined; |
| 9 | if ( |
| 10 | token.fontStyle !== undefined && |
| 11 | token.fontStyle !== shiki.FontStyle.NotSet && |
| 12 | token.fontStyle !== shiki.FontStyle.None |
| 13 | ) { |
| 14 | modifiers = []; |
| 15 | if (token.fontStyle & shiki.FontStyle.Bold) { |
| 16 | modifiers.push('bold'); |
| 17 | } |
| 18 | if (token.fontStyle & shiki.FontStyle.Italic) { |
| 19 | modifiers.push('italic'); |
| 20 | } |
| 21 | if (token.fontStyle & shiki.FontStyle.Underline) { |
| 22 | modifiers.push('underline'); |
| 23 | } |
| 24 | } |
| 25 | const themeColor = parseColorDefinition({ |
| 26 | color: token.color, |
| 27 | backgroundColor: token.bgColor, |
| 28 | modifiers, |
| 29 | }); |
| 30 | return themeColor; |
| 31 | } |
| 32 | |
| 33 | export async function highlightSyntaxInLine( |
| 34 | line: FormattedString, |
no test coverage detected