Skip to content

Commit 72e69ea

Browse files
Merge pull request #671 from thejackshelton/shiki-utf8
fix: shiki utf8 string error
2 parents 50507d5 + 21971c5 commit 72e69ea

File tree

4 files changed

+20
-29
lines changed

4 files changed

+20
-29
lines changed

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ClassList, PropsOf, component$, useSignal, useTask$ } from '@builder.io/qwik';
22
import { CodeCopy } from '../code-copy/code-copy';
3+
import { getHighlighterCore } from 'shiki';
34
import { cn } from '@qwik-ui/utils';
4-
import { highlighter } from './highlighter';
55

66
export type HighlightProps = PropsOf<'div'> & {
77
code: string;
@@ -22,6 +22,7 @@ export const Highlight = component$(
2222
}: HighlightProps) => {
2323
const codeSig = useSignal('');
2424

25+
// eslint-disable-next-line qwik/no-use-visible-task
2526
useTask$(async function createHighlightedCode() {
2627
let modifiedCode: string = code;
2728

@@ -35,6 +36,19 @@ export const Highlight = component$(
3536
modifiedCode = partsOfCode[0];
3637
}
3738

39+
const highlighter = await getHighlighterCore({
40+
themes: [
41+
// or a dynamic import if you want to do chunk splitting
42+
import('shiki/themes/poimandres.mjs'),
43+
],
44+
langs: [
45+
import('shiki/langs/html.mjs'),
46+
import('shiki/langs/tsx.mjs'),
47+
import('shiki/langs/css.mjs'),
48+
],
49+
loadWasm: import('shiki/wasm'),
50+
});
51+
3852
const str = highlighter.codeToHtml(modifiedCode, {
3953
lang: language,
4054
themes: {

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

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

apps/website/src/routes/docs/headless/collapsible/index.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,11 @@ Padding or border applied to `CollapsibleContent` breaks our keyframe animation
120120

121121
To fix this, add a child element to the content, and set the padding or border on that element.
122122

123-
<CodeSnippet name="content-child" />
123+
```tsx
124+
<CollapsibleContent class="collapsible-animation collapsible-content">
125+
<p class="collapsible-content-outline">Content</p>
126+
</CollapsibleContent>
127+
```
124128

125129
> Rather than dealing with this under the hood, we thought it'd be appropriate to keep style management as simple as possible. Let us know if you have a better solution!
126130

apps/website/src/routes/docs/headless/collapsible/snippets/content-child.tsx

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

0 commit comments

Comments
 (0)