From c9acd17bb51c7c3007473bc09a4f38959444b109 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Mon, 28 Oct 2024 21:32:40 +0900 Subject: [PATCH] fix(cli): multiple fontStyle --- packages/cli/src/code-to-ansi.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/code-to-ansi.ts b/packages/cli/src/code-to-ansi.ts index a1bdb5cc4..ca1fa1b09 100644 --- a/packages/cli/src/code-to-ansi.ts +++ b/packages/cli/src/code-to-ansi.ts @@ -21,10 +21,14 @@ export async function codeToANSI(code: string, lang: BundledLanguage, theme: Bun const color = token.color || themeReg.fg if (color) text = c.hex(hexApplyAlpha(color, themeReg.type))(text) - if (token.fontStyle === FontStyle.Bold) - text = c.bold(text) - if (token.fontStyle === FontStyle.Italic) - text = c.italic(text) + if (token.fontStyle) { + if (token.fontStyle & FontStyle.Bold) + text = c.bold(text) + if (token.fontStyle & FontStyle.Italic) + text = c.italic(text) + if (token.fontStyle & FontStyle.Underline) + text = c.underline(text) + } output += text } output += '\n'