-
Notifications
You must be signed in to change notification settings - Fork 37
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
fix: improve code highlight style, close #222, #223 #226
Conversation
Pull Request Test Coverage Report for Build 10107871722Details
💛 - Coveralls |
onMounted(() => { | ||
if (!groupRef.value) return | ||
const codeBlock = groupRef.value.querySelector( | ||
'div[class*="language-"]', | ||
) as HTMLDivElement | ||
if (codeBlock && codeBlock.dataset.highlighter === 'shiki') { | ||
const lightColor = codeBlock.style.getPropertyValue('--shiki-light') | ||
const darkColor = codeBlock.style.getPropertyValue('--shiki-dark') | ||
const lightBg = codeBlock.style.getPropertyValue('--shiki-light-bg') | ||
const darkBg = codeBlock.style.getPropertyValue('--shiki-dark-bg') | ||
watch( | ||
isDark, | ||
(val) => { | ||
groupRef.value!.style.setProperty( | ||
'--c-code-group-tab-bg', | ||
val ? darkBg : lightBg, | ||
) | ||
groupRef.value!.style.setProperty( | ||
'--c-code-group-tab-title', | ||
val ? darkColor : lightColor, | ||
) | ||
}, | ||
{ immediate: true }, | ||
) | ||
} | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the code work with prismjs? I did not see any fallback from it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prismjs is functioning properly and does not require JavaScript to calculate styles.
Before submitting the PR, please make sure you do the following
close #123
).What is the purpose of this pull request?
Description
close #222
close #223