Skip to content

Commit 59704ca

Browse files
authored
Prevent theme class names in Shiki snippets (#42283)
* Prevent theme class names in Shiki snippets * prettier * alt: dont render at all * prettier
1 parent 74b5a4d commit 59704ca

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

site/astro.config.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,15 @@ export default defineConfig({
3939
syntaxHighlight: 'shiki',
4040
shikiConfig: {
4141
themes: {
42-
light: bootstrapLight,
43-
dark: bootstrapDark
42+
light: { ...bootstrapLight, name: '' },
43+
dark: { ...bootstrapDark, name: '' }
4444
},
4545
transformers: [
4646
transformerNotationDiff(),
4747
transformerNotationHighlight(),
4848
{
4949
name: 'add-language-attribute',
5050
pre(node) {
51-
// Add data-language attribute to pre tag so Code component can access it
5251
const lang = this.options.lang
5352
if (lang) {
5453
node.properties['dataLanguage'] = lang

site/src/libs/highlight.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ export async function highlightCode(
5555
const highlighted = await codeToHtml(code, {
5656
lang,
5757
themes: {
58-
light: bootstrapLight as any,
59-
dark: bootstrapDark as any
58+
light: { ...(bootstrapLight as any), name: '' },
59+
dark: { ...(bootstrapDark as any), name: '' }
6060
},
6161
transformers
6262
})

0 commit comments

Comments
 (0)