Skip to content

Commit a2ea492

Browse files
committed
chore: merge conflicts
2 parents b8fd1b5 + 87c0a05 commit a2ea492

File tree

8 files changed

+43
-56
lines changed

8 files changed

+43
-56
lines changed

apps/website/src/_state/app-state.type.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
import { NoSerialize } from '@builder.io/qwik';
2-
import type { Highlighter } from 'shiki';
3-
41
export interface AppState {
52
mode: 'light' | 'dark';
6-
highlighter?: NoSerialize<Highlighter>;
73
isSidebarOpened: boolean;
84
featureFlags?: {
95
showFluffy?: boolean;

apps/website/src/components/highlight/get-or-create-highlighter.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

apps/website/src/components/highlight/highlight.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
useVisibleTask$,
77
} from '@builder.io/qwik';
88
import { CodeCopy } from '../code-copy/code-copy';
9+
import { codeToHtml } from 'shikiji';
910

1011
export type HighlightProps = PropsOf<'div'> & {
1112
code: string;
@@ -29,8 +30,6 @@ export const Highlight = component$(
2930
// eslint-disable-next-line qwik/no-use-visible-task
3031
useVisibleTask$(
3132
async function createHighlightedCode() {
32-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
33-
const highlighter = await (window as any).shikiji;
3433
let modifiedCode: string = code;
3534

3635
let partsOfCode = modifiedCode.split(splitCommentStart);
@@ -43,7 +42,7 @@ export const Highlight = component$(
4342
modifiedCode = partsOfCode[0];
4443
}
4544

46-
const str = await highlighter.codeToHtml(modifiedCode, {
45+
const str = await codeToHtml(modifiedCode, {
4746
lang: language,
4847
themes: {
4948
light: 'poimandres',

apps/website/src/components/mdx-components/index.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,20 +95,11 @@ export const components: Record<string, any> = {
9595
<div
9696
{...props}
9797
class={[
98-
cn(
99-
'code-example relative -mx-6 mb-6 max-h-[31.25rem] rounded-xl bg-slate-900 lg:-mx-8',
100-
props.class,
101-
),
98+
cn('relative -mx-6 mb-6 max-h-[31.25rem] rounded-xl lg:-mx-8', props.class),
10299
]}
103100
>
104-
<CodeCopy
105-
class="absolute right-4 top-4 border-2 text-slate-50 hover:bg-slate-800 hover:text-slate-50"
106-
code={__rawString__}
107-
/>
108-
<div
109-
style={''} // required to override shiki's
110-
class="tab-size max-h-[31.25rem] max-w-full overflow-auto rounded-xl border bg-gradient-to-b from-slate-900 to-slate-800 p-6 text-sm"
111-
>
101+
<CodeCopy class="absolute right-4 top-4" code={__rawString__} />
102+
<div class="max-h-[31.25rem] max-w-full overflow-auto rounded-xl border bg-gradient-to-b from-slate-900 to-slate-800 p-6 text-sm">
112103
<pre>
113104
<Slot />
114105
</pre>

apps/website/src/root.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,6 @@ export default component$(() => {
6464
<meta charSet="utf-8" />
6565
<link rel="manifest" href="/manifest.json" />
6666
<RouterHead />
67-
<script
68-
type="module"
69-
dangerouslySetInnerHTML={
70-
/*javascript*/ `
71-
window.shikiji = import('https://esm.sh/[email protected]');
72-
`
73-
}
74-
/>
7567
</head>
7668
<body
7769
lang="en"

apps/website/vite.config.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,10 @@ import { defineConfig } from 'vite';
55
import tsconfigPaths from 'vite-tsconfig-paths';
66
import { recmaProvideComponents } from './recma-provide-components';
77

8-
import { getHighlighter, type Highlighter } from 'shiki';
9-
10-
let highlighter: Highlighter;
11-
128
export default defineConfig(async () => {
139
const { default: rehypePrettyCode } = await import('rehype-pretty-code');
1410
const { visit } = await import('unist-util-visit');
1511

16-
async function getOrCreateHighlighter() {
17-
if (highlighter) {
18-
return highlighter;
19-
}
20-
highlighter = await getHighlighter({ theme: 'poimandres' });
21-
return highlighter;
22-
}
2312
return {
2413
plugins: [
2514
qwikNxVite(),
@@ -31,6 +20,7 @@ export default defineConfig(async () => {
3120
},
3221
mdx: {
3322
providerImportSource: '~/_state/MDXProvider',
23+
// @ts-ignore
3424
recmaPlugins: [recmaProvideComponents],
3525
rehypePlugins: [
3626
() => (tree) => {
@@ -46,9 +36,10 @@ export default defineConfig(async () => {
4636
});
4737
},
4838
[
39+
// @ts-ignore
4940
rehypePrettyCode,
5041
{
51-
getHighlighter: getOrCreateHighlighter,
42+
theme: 'poimandres',
5243
onVisitLine(node: any) {
5344
// Prevent lines from collapsing in `display: grid` mode, and allow empty
5445
// lines to be copy/pasted

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
"react-dom": "18.2.0",
126126
"rehype-pretty-code": "^0.10.2",
127127
"sass": "^1.66.1",
128-
"shiki": "0.14.5",
128+
"shikiji": "0.9.18",
129129
"storybook": "^7.4.0",
130130
"storybook-framework-qwik": "^0.2.3",
131131
"tailwind-merge": "^1.14.0",
@@ -136,7 +136,7 @@
136136
"tsm": "2.3.0",
137137
"typescript": "^5.2.2",
138138
"undici": "^5.23.0",
139-
"unified": "^10.1.2",
139+
"unified": "^11.0.4",
140140
"unist-util-visit": "^5.0.0",
141141
"verdaccio": "^5.0.4",
142142
"vite": "^5.0.4",

pnpm-lock.yaml

Lines changed: 33 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)