Skip to content

Commit 52804e2

Browse files
committed
docs(vite.config): update fix copy/paste issue after shiki update
1 parent 5e1a358 commit 52804e2

File tree

1 file changed

+2
-25
lines changed

1 file changed

+2
-25
lines changed

apps/website/vite.config.ts

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export default defineConfig(async () => {
2121
},
2222
mdx: {
2323
providerImportSource: '~/_state/MDXProvider',
24-
// @ts-ignore
2524
recmaPlugins: [recmaProvideComponents],
2625
rehypePlugins: [
2726
() => (tree) => {
@@ -31,48 +30,26 @@ export default defineConfig(async () => {
3130
if (codeEl.tagName !== 'code') {
3231
return;
3332
}
34-
3533
node.__rawString__ = codeEl.children?.[0].value;
3634
}
3735
});
3836
},
3937
[
40-
// @ts-ignore
4138
rehypePrettyCode,
4239
{
4340
theme: 'poimandres',
44-
onVisitLine(node: any) {
45-
// Prevent lines from collapsing in `display: grid` mode, and allow empty
46-
// lines to be copy/pasted
47-
if (node.children.length === 0) {
48-
node.children = [{ type: 'text', value: ' ' }];
49-
}
50-
},
51-
onVisitHighlightedLine(node: any) {
52-
// Each line node by default has `class="line"`.
53-
if (node.properties.className) {
54-
node.properties.className.push('line--highlighted');
55-
}
56-
},
57-
onVisitHighlightedWord(node: any) {
58-
if (node.properties.className) {
59-
node.properties.className = ['word--highlighted'];
60-
}
61-
},
6241
},
6342
],
6443
() => (tree) => {
6544
visit(tree, (node) => {
66-
if (node?.type === 'element' && node?.tagName === 'div') {
67-
if (!('data-rehype-pretty-code-fragment' in node.properties)) {
45+
if (node?.type === 'element' && node?.tagName === 'figure') {
46+
if (!('data-rehype-pretty-code-figure' in node.properties)) {
6847
return;
6948
}
70-
7149
const preElement = node.children.at(-1);
7250
if (preElement.tagName !== 'pre') {
7351
return;
7452
}
75-
7653
preElement.properties['__rawString__'] = node.__rawString__;
7754
}
7855
});

0 commit comments

Comments
 (0)