Skip to content

Commit 5b8c6e8

Browse files
eslteacher902010coseeian
authored andcommitted
Upgrade Shiki and switch to GitHub Light High Contrast theme for code blocks
1 parent df80e3e commit 5b8c6e8

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/components/AnnotatedCode/index.astro

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,12 @@ const code = rows.map((row) => row.code).join('');
5252
// Convert it to HTML with style tags
5353
const html = await codeToHtml(code, {
5454
lang: props.lang || 'javascript',
55-
theme: props.theme || 'github-light',
55+
theme: props.theme || 'github-light-high-contrast',
5656
})
5757
58+
console.log("Shiki theme in use:", props.theme || 'github-light-high-contrast');
59+
console.log(html.slice(0, 300));
60+
5861
// Turn it into a DOM tree we can query
5962
const parsed = new JSDOM(html)
6063
const dom = parsed.window.document

src/components/CodeEmbed/index.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { CodeFrame } from "./frame";
88
import { CopyCodeButton } from "../CopyCodeButton";
99
import CircleButton from "../CircleButton";
1010
import { Icon } from "../Icon";
11+
import { githubLightHighContrast } from '@uiw/codemirror-theme-github';
12+
1113
/*
1214
* A more featured code embed component that uses CodeMirror
1315
*
@@ -123,7 +125,7 @@ export const CodeEmbed = (props) => {
123125
<div className="code-editor-container relative w-full">
124126
<CodeMirror
125127
value={codeString}
126-
theme="light"
128+
theme= {githubLightHighContrast}
127129
width="100%"
128130
minimalSetup={{
129131
highlightSpecialChars: false,

0 commit comments

Comments
 (0)