Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(cli): code-to-ansi #807

Closed
wants to merge 1 commit into from
Closed

Conversation

Simon-He95
Copy link

Description

Linked Issues

Additional context

Copy link

netlify bot commented Oct 11, 2024

Deploy Preview for shiki-matsu ready!

Name Link
🔨 Latest commit 7eb30fb
🔍 Latest deploy log https://app.netlify.com/sites/shiki-matsu/deploys/6708dac0b49f2a000830dcc6
😎 Deploy Preview https://deploy-preview-807--shiki-matsu.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Oct 11, 2024

Deploy Preview for shiki-next ready!

Name Link
🔨 Latest commit 7eb30fb
🔍 Latest deploy log https://app.netlify.com/sites/shiki-next/deploys/6708dac0a0063500083ad4f6
😎 Deploy Preview https://deploy-preview-807--shiki-next.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@antfu
Copy link
Member

antfu commented Oct 12, 2024

Do you have an issue regarding this? I guess that bold and italic can exist at the same time

@Simon-He95
Copy link
Author

Do you have an issue regarding this? I guess that bold and italic can exist at the same time您对此有什么问题吗?我想粗体和斜体可以同时存在

token.fontStyle is impossible to satisfy both FontStyle.Bold and FontStyle.Italic at the same time

@antfu
Copy link
Member

antfu commented Oct 12, 2024

Actually it's a bug in another way: we need to use AND to do bitwis comparison:

if (token.fontStyle) {
if (token.fontStyle & FontStyle.Italic)
styles['font-style'] = 'italic'
if (token.fontStyle & FontStyle.Bold)
styles['font-weight'] = 'bold'
if (token.fontStyle & FontStyle.Underline)
styles['text-decoration'] = 'underline'
}

@Simon-He95
Copy link
Author

Actually it's a bug in another way: we need to use AND to do bitwis comparison:实际上,从另一个方面来说,这是一个错误:我们需要使用 AND 来做 bitwis 比较:

if (token.fontStyle) {
if (token.fontStyle & FontStyle.Italic)
styles['font-style'] = 'italic'
if (token.fontStyle & FontStyle.Bold)
styles['font-weight'] = 'bold'
if (token.fontStyle & FontStyle.Underline)
styles['text-decoration'] = 'underline'
}

My mistake. I ignored text as the next parameter.

@Simon-He95 Simon-He95 closed this Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants