@@ -21,7 +21,6 @@ export default defineConfig(async () => {
21
21
} ,
22
22
mdx : {
23
23
providerImportSource : '~/_state/MDXProvider' ,
24
- // @ts -ignore
25
24
recmaPlugins : [ recmaProvideComponents ] ,
26
25
rehypePlugins : [
27
26
( ) => ( tree ) => {
@@ -31,48 +30,26 @@ export default defineConfig(async () => {
31
30
if ( codeEl . tagName !== 'code' ) {
32
31
return ;
33
32
}
34
-
35
33
node . __rawString__ = codeEl . children ?. [ 0 ] . value ;
36
34
}
37
35
} ) ;
38
36
} ,
39
37
[
40
- // @ts -ignore
41
38
rehypePrettyCode ,
42
39
{
43
40
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
- } ,
62
41
} ,
63
42
] ,
64
43
( ) => ( tree ) => {
65
44
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 ) ) {
68
47
return ;
69
48
}
70
-
71
49
const preElement = node . children . at ( - 1 ) ;
72
50
if ( preElement . tagName !== 'pre' ) {
73
51
return ;
74
52
}
75
-
76
53
preElement . properties [ '__rawString__' ] = node . __rawString__ ;
77
54
}
78
55
} ) ;
0 commit comments