mirror of https://github.com/vuejs/vitepress
feat(markdown): expose Shiki color replacements in markdown options (#5153)
parent
6dd3632960
commit
fccc617102
@ -0,0 +1,26 @@
|
||||
import { highlight } from 'node/markdown/plugins/highlight'
|
||||
|
||||
describe('node/markdown/plugins/highlight', () => {
|
||||
test('passes color replacements through markdown options', async () => {
|
||||
const [render, dispose] = await highlight(
|
||||
{ light: 'github-light', dark: 'github-dark' },
|
||||
{
|
||||
colorReplacements: {
|
||||
'github-light': {
|
||||
'#005cc5': '#000000'
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
try {
|
||||
const html = await render('const a = 1', 'js', '')
|
||||
|
||||
expect(html).toContain('--shiki-light:#000000')
|
||||
expect(html).toContain('--shiki-dark:#79B8FF')
|
||||
expect(html).not.toContain('--shiki-light:#005CC5')
|
||||
} finally {
|
||||
dispose()
|
||||
}
|
||||
})
|
||||
})
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,11 @@
|
||||
.dark .shiki span {
|
||||
color: var(--shiki-dark, inherit);
|
||||
text-decoration: var(--shiki-dark-text-decoration, inherit);
|
||||
font-weight: var(--shiki-dark-font-weight, inherit);
|
||||
}
|
||||
|
||||
html:not(.dark) .shiki span {
|
||||
color: var(--shiki-light, inherit);
|
||||
text-decoration: var(--shiki-light-text-decoration, inherit);
|
||||
font-weight: var(--shiki-light-font-weight, inherit);
|
||||
}
|
||||
|
||||
Loading…
Reference in new issue