@@ -175,6 +175,55 @@ const A = ({ href = '', ...props }) => (
175
175
< Anchor href = { href } newWindow = { EXTERNAL_HREF_REGEX . test ( href ) } { ...props } />
176
176
)
177
177
178
+ const DEFAULT_COMPONENTS : Components = {
179
+ h1 : props => (
180
+ < h1
181
+ className = "_mt-2 _text-4xl _font-bold _tracking-tight _text-slate-900 dark:_text-slate-100"
182
+ { ...props }
183
+ />
184
+ ) ,
185
+ ul : props => (
186
+ < ul
187
+ className = "_mt-6 _list-disc first:_mt-0 ltr:_ml-6 rtl:_mr-6"
188
+ { ...props }
189
+ />
190
+ ) ,
191
+ ol : props => (
192
+ < ol
193
+ className = "_mt-6 _list-decimal first:_mt-0 ltr:_ml-6 rtl:_mr-6"
194
+ { ...props }
195
+ />
196
+ ) ,
197
+ li : props => < li className = "_my-2" { ...props } /> ,
198
+ blockquote : props => (
199
+ < blockquote
200
+ className = { cn (
201
+ '_mt-6 _border-gray-300 _italic _text-gray-700 dark:_border-gray-700 dark:_text-gray-400' ,
202
+ 'first:_mt-0 ltr:_border-l-2 ltr:_pl-6 rtl:_border-r-2 rtl:_pr-6'
203
+ ) }
204
+ { ...props }
205
+ />
206
+ ) ,
207
+ hr : props => (
208
+ < hr
209
+ className = "_my-8 _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400"
210
+ { ...props }
211
+ />
212
+ ) ,
213
+ a : Link ,
214
+ table : props => (
215
+ < Table className = "nextra-scrollbar _mt-6 _p-0 first:_mt-0" { ...props } />
216
+ ) ,
217
+ p : props => < p className = "_mt-6 _leading-7 first:_mt-0" { ...props } /> ,
218
+ tr : Tr ,
219
+ th : Th ,
220
+ td : Td ,
221
+ details : Details ,
222
+ summary : Summary ,
223
+ pre : Pre ,
224
+ code : Code
225
+ }
226
+
178
227
export function getComponents ( {
179
228
isRawLayout,
180
229
components
@@ -188,57 +237,12 @@ export function getComponents({
188
237
189
238
const context = { index : 0 }
190
239
return {
191
- h1 : props => (
192
- < h1
193
- className = "_mt-2 _text-4xl _font-bold _tracking-tight _text-slate-900 dark:_text-slate-100"
194
- { ...props }
195
- />
196
- ) ,
240
+ ...DEFAULT_COMPONENTS ,
197
241
h2 : createHeading ( 'h2' , context ) ,
198
242
h3 : createHeading ( 'h3' , context ) ,
199
243
h4 : createHeading ( 'h4' , context ) ,
200
244
h5 : createHeading ( 'h5' , context ) ,
201
245
h6 : createHeading ( 'h6' , context ) ,
202
- ul : props => (
203
- < ul
204
- className = "_mt-6 _list-disc first:_mt-0 ltr:_ml-6 rtl:_mr-6"
205
- { ...props }
206
- />
207
- ) ,
208
- ol : props => (
209
- < ol
210
- className = "_mt-6 _list-decimal first:_mt-0 ltr:_ml-6 rtl:_mr-6"
211
- { ...props }
212
- />
213
- ) ,
214
- li : props => < li className = "_my-2" { ...props } /> ,
215
- blockquote : props => (
216
- < blockquote
217
- className = { cn (
218
- '_mt-6 _border-gray-300 _italic _text-gray-700 dark:_border-gray-700 dark:_text-gray-400' ,
219
- 'first:_mt-0 ltr:_border-l-2 ltr:_pl-6 rtl:_border-r-2 rtl:_pr-6'
220
- ) }
221
- { ...props }
222
- />
223
- ) ,
224
- hr : props => (
225
- < hr
226
- className = "_my-8 _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400"
227
- { ...props }
228
- />
229
- ) ,
230
- a : Link ,
231
- table : props => (
232
- < Table className = "nextra-scrollbar _mt-6 _p-0 first:_mt-0" { ...props } />
233
- ) ,
234
- p : props => < p className = "_mt-6 _leading-7 first:_mt-0" { ...props } /> ,
235
- tr : Tr ,
236
- th : Th ,
237
- td : Td ,
238
- details : Details ,
239
- summary : Summary ,
240
- pre : Pre ,
241
- code : Code ,
242
246
...components
243
247
}
244
248
}
0 commit comments