@@ -36,7 +36,9 @@ const CodeHeader: FC<CodeHeaderProps> = ({ language, code }) => {
36
36
37
37
return (
38
38
< div className = "aui-code-header-root mt-4 flex items-center justify-between gap-4 rounded-t-lg bg-muted-foreground/15 px-4 py-2 text-sm font-semibold text-foreground dark:bg-muted-foreground/20" >
39
- < span className = "aui-code-header-language lowercase [&>span]:text-xs" > { language } </ span >
39
+ < span className = "aui-code-header-language lowercase [&>span]:text-xs" >
40
+ { language }
41
+ </ span >
40
42
< TooltipIconButton tooltip = "Copy" onClick = { onCopy } >
41
43
{ ! isCopied && < CopyIcon /> }
42
44
{ isCopied && < CheckIcon /> }
@@ -66,64 +68,158 @@ const useCopyToClipboard = ({
66
68
67
69
const defaultComponents = memoizeMarkdownComponents ( {
68
70
h1 : ( { className, ...props } ) => (
69
- < h1 className = { cn ( "aui-md-h1 mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0" , className ) } { ...props } />
71
+ < h1
72
+ className = { cn (
73
+ "aui-md-h1 mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0" ,
74
+ className ,
75
+ ) }
76
+ { ...props }
77
+ />
70
78
) ,
71
79
h2 : ( { className, ...props } ) => (
72
- < h2 className = { cn ( "aui-md-h2 mt-8 mb-4 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0" , className ) } { ...props } />
80
+ < h2
81
+ className = { cn (
82
+ "aui-md-h2 mt-8 mb-4 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0" ,
83
+ className ,
84
+ ) }
85
+ { ...props }
86
+ />
73
87
) ,
74
88
h3 : ( { className, ...props } ) => (
75
- < h3 className = { cn ( "aui-md-h3 mt-6 mb-4 scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0" , className ) } { ...props } />
89
+ < h3
90
+ className = { cn (
91
+ "aui-md-h3 mt-6 mb-4 scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0" ,
92
+ className ,
93
+ ) }
94
+ { ...props }
95
+ />
76
96
) ,
77
97
h4 : ( { className, ...props } ) => (
78
- < h4 className = { cn ( "aui-md-h4 mt-6 mb-4 scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0" , className ) } { ...props } />
98
+ < h4
99
+ className = { cn (
100
+ "aui-md-h4 mt-6 mb-4 scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0" ,
101
+ className ,
102
+ ) }
103
+ { ...props }
104
+ />
79
105
) ,
80
106
h5 : ( { className, ...props } ) => (
81
- < h5 className = { cn ( "aui-md-h5 my-4 text-lg font-semibold first:mt-0 last:mb-0" , className ) } { ...props } />
107
+ < h5
108
+ className = { cn (
109
+ "aui-md-h5 my-4 text-lg font-semibold first:mt-0 last:mb-0" ,
110
+ className ,
111
+ ) }
112
+ { ...props }
113
+ />
82
114
) ,
83
115
h6 : ( { className, ...props } ) => (
84
- < h6 className = { cn ( "aui-md-h6 my-4 font-semibold first:mt-0 last:mb-0" , className ) } { ...props } />
116
+ < h6
117
+ className = { cn (
118
+ "aui-md-h6 my-4 font-semibold first:mt-0 last:mb-0" ,
119
+ className ,
120
+ ) }
121
+ { ...props }
122
+ />
85
123
) ,
86
124
p : ( { className, ...props } ) => (
87
- < p className = { cn ( "aui-md-p mt-5 mb-5 leading-7 first:mt-0 last:mb-0" , className ) } { ...props } />
125
+ < p
126
+ className = { cn (
127
+ "aui-md-p mt-5 mb-5 leading-7 first:mt-0 last:mb-0" ,
128
+ className ,
129
+ ) }
130
+ { ...props }
131
+ />
88
132
) ,
89
133
a : ( { className, ...props } ) => (
90
- < a className = { cn ( "aui-md-a font-medium text-primary underline underline-offset-4" , className ) } { ...props } />
134
+ < a
135
+ className = { cn (
136
+ "aui-md-a font-medium text-primary underline underline-offset-4" ,
137
+ className ,
138
+ ) }
139
+ { ...props }
140
+ />
91
141
) ,
92
142
blockquote : ( { className, ...props } ) => (
93
- < blockquote className = { cn ( "aui-md-blockquote border-l-2 pl-6 italic" , className ) } { ...props } />
143
+ < blockquote
144
+ className = { cn ( "aui-md-blockquote border-l-2 pl-6 italic" , className ) }
145
+ { ...props }
146
+ />
94
147
) ,
95
148
ul : ( { className, ...props } ) => (
96
- < ul className = { cn ( "aui-md-ul my-5 ml-6 list-disc [&>li]:mt-2" , className ) } { ...props } />
149
+ < ul
150
+ className = { cn ( "aui-md-ul my-5 ml-6 list-disc [&>li]:mt-2" , className ) }
151
+ { ...props }
152
+ />
97
153
) ,
98
154
ol : ( { className, ...props } ) => (
99
- < ol className = { cn ( "aui-md-ol my-5 ml-6 list-decimal [&>li]:mt-2" , className ) } { ...props } />
155
+ < ol
156
+ className = { cn ( "aui-md-ol my-5 ml-6 list-decimal [&>li]:mt-2" , className ) }
157
+ { ...props }
158
+ />
100
159
) ,
101
160
hr : ( { className, ...props } ) => (
102
161
< hr className = { cn ( "aui-md-hr my-5 border-b" , className ) } { ...props } />
103
162
) ,
104
163
table : ( { className, ...props } ) => (
105
- < table className = { cn ( "aui-md-table my-5 w-full border-separate border-spacing-0 overflow-y-auto" , className ) } { ...props } />
164
+ < table
165
+ className = { cn (
166
+ "aui-md-table my-5 w-full border-separate border-spacing-0 overflow-y-auto" ,
167
+ className ,
168
+ ) }
169
+ { ...props }
170
+ />
106
171
) ,
107
172
th : ( { className, ...props } ) => (
108
- < th className = { cn ( "aui-md-th bg-muted px-4 py-2 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [&[align=center]]:text-center [&[align=right]]:text-right" , className ) } { ...props } />
173
+ < th
174
+ className = { cn (
175
+ "aui-md-th bg-muted px-4 py-2 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [&[align=center]]:text-center [&[align=right]]:text-right" ,
176
+ className ,
177
+ ) }
178
+ { ...props }
179
+ />
109
180
) ,
110
181
td : ( { className, ...props } ) => (
111
- < td className = { cn ( "aui-md-td border-b border-l px-4 py-2 text-left last:border-r [&[align=center]]:text-center [&[align=right]]:text-right" , className ) } { ...props } />
182
+ < td
183
+ className = { cn (
184
+ "aui-md-td border-b border-l px-4 py-2 text-left last:border-r [&[align=center]]:text-center [&[align=right]]:text-right" ,
185
+ className ,
186
+ ) }
187
+ { ...props }
188
+ />
112
189
) ,
113
190
tr : ( { className, ...props } ) => (
114
- < tr className = { cn ( "aui-md-tr m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg" , className ) } { ...props } />
191
+ < tr
192
+ className = { cn (
193
+ "aui-md-tr m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg" ,
194
+ className ,
195
+ ) }
196
+ { ...props }
197
+ />
115
198
) ,
116
199
sup : ( { className, ...props } ) => (
117
- < sup className = { cn ( "aui-md-sup [&>a]:text-xs [&>a]:no-underline" , className ) } { ...props } />
200
+ < sup
201
+ className = { cn ( "aui-md-sup [&>a]:text-xs [&>a]:no-underline" , className ) }
202
+ { ...props }
203
+ />
118
204
) ,
119
205
pre : ( { className, ...props } ) => (
120
- < pre className = { cn ( "aui-md-pre overflow-x-auto !rounded-t-none rounded-b-lg bg-black p-4 text-white" , className ) } { ...props } />
206
+ < pre
207
+ className = { cn (
208
+ "aui-md-pre overflow-x-auto !rounded-t-none rounded-b-lg bg-black p-4 text-white" ,
209
+ className ,
210
+ ) }
211
+ { ...props }
212
+ />
121
213
) ,
122
214
code : function Code ( { className, ...props } ) {
123
215
const isCodeBlock = useIsMarkdownCodeBlock ( ) ;
124
216
return (
125
217
< code
126
- className = { cn ( ! isCodeBlock && "aui-md-inline-code rounded border bg-muted font-semibold" , className ) }
218
+ className = { cn (
219
+ ! isCodeBlock &&
220
+ "aui-md-inline-code rounded border bg-muted font-semibold" ,
221
+ className ,
222
+ ) }
127
223
{ ...props }
128
224
/>
129
225
) ;
0 commit comments