File tree Expand file tree Collapse file tree 9 files changed +20
-414
lines changed Expand file tree Collapse file tree 9 files changed +20
-414
lines changed Original file line number Diff line number Diff line change 1- import '@mintlify/mdx/dist/styles.css' ;
21import type { Metadata } from 'next' ;
32
43import '@/app/globals.css' ;
Original file line number Diff line number Diff line change @@ -30,23 +30,3 @@ You can check out the demo of [this page](https://github.com/mintlify/mdx/blob/m
3030 );
3131 }
3232 ```
33-
34- 2 . Import ` @mintlify/mdx/dist/styles.css ` inside your ` layout.tsx ` file. This file contains the styles for the code syntax highlighting.
35-
36- ``` tsx
37- import ' @mintlify/mdx/dist/styles.css' ;
38- import type { Metadata } from ' next' ;
39-
40- export const metadata: Metadata = {
41- title: ' Create Next App' ,
42- description: ' Generated by create next app' ,
43- };
44-
45- export default function RootLayout({ children }: { children: React .ReactNode }) {
46- return (
47- <html lang = " en" >
48- <body >{ children } </body >
49- </html >
50- );
51- }
52- ```
Original file line number Diff line number Diff line change 1- import '@mintlify/mdx/dist/styles.css' ;
21import { AppProps } from 'next/app' ;
32
43import '@/styles/globals.css' ;
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ You can check out the demo of [this page](https://github.com/mintlify/mdx/blob/m
1919 });
2020
2121 if (' error' in mdxSource ) {
22- // handle error case
22+ // handle error case
2323 }
2424
2525 return { props: { mdxSource } };
@@ -35,14 +35,3 @@ You can check out the demo of [this page](https://github.com/mintlify/mdx/blob/m
3535 return <MDXClient { ... mdxSource } />;
3636 }
3737 ```
38-
39- 3 . Import ` @mintlify/mdx/dist/styles.css ` inside your ` _app.tsx ` file. This file contains the styles for the code syntax highlighting.
40-
41- ``` tsx
42- import ' @mintlify/mdx/dist/styles.css' ;
43- import { AppProps } from ' next/app' ;
44-
45- export default function App({ Component , pageProps }: AppProps ) {
46- return <Component { ... pageProps } />;
47- }
48- ```
Original file line number Diff line number Diff line change 55 "main" : " ./dist/index.js" ,
66 "types" : " ./dist/index.d.ts" ,
77 "sideEffects" : false ,
8- "files" : [
9- " dist"
10- ],
8+ "files" : [" dist" ],
119 "exports" : {
1210 "." : {
1311 "import" : " ./dist/index.js" ,
2927 },
3028 "scripts" : {
3129 "prepare" : " npm run build" ,
32- "build" : " tsc --project tsconfig.build.json && yarn copy:css " ,
30+ "build" : " tsc --project tsconfig.build.json" ,
3331 "clean:build" : " rimraf dist" ,
3432 "clean:all" : " rimraf node_modules .eslintcache && yarn clean:build" ,
3533 "watch" : " tsc --watch" ,
3634 "type" : " tsc --noEmit" ,
3735 "lint" : " eslint . --cache" ,
3836 "format" : " prettier . --write" ,
39- "format:check" : " prettier . --check" ,
40- "copy:css" : " cp -r ./src/styles/prism.css ./dist/styles.css"
37+ "format:check" : " prettier . --check"
4138 },
4239 "author" : " Mintlify, Inc." ,
4340 "license" : " MIT" ,
Original file line number Diff line number Diff line change 88 DEFAULT_LANG_ALIASES ,
99 SHIKI_THEMES ,
1010 UNIQUE_LANGS ,
11+ DEFAULT_LANG ,
1112 type ShikiLang ,
1213 type ShikiTheme ,
1314} from './shiki-constants.js' ;
@@ -92,15 +93,15 @@ export const rehypeSyntaxHighlighting: Plugin<[RehypeSyntaxHighlightingOptions?]
9293 let lang =
9394 getLanguage ( node , DEFAULT_LANG_ALIASES ) ??
9495 getLanguage ( child , DEFAULT_LANG_ALIASES ) ??
95- 'text' ;
96+ DEFAULT_LANG ;
9697
9798 try {
9899 const code = toString ( node ) ;
99100 const lines = code . split ( '\n' ) ;
100101 let linesToHighlight = getLinesToHighlight ( node , lines . length ) ;
101102
102103 const hast = highlighter . codeToHast ( code , {
103- lang : lang ?? 'text' ,
104+ lang : lang ?? DEFAULT_LANG ,
104105 themes : {
105106 light :
106107 options . themes ?. light ??
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import type { BundledLanguage } from 'shiki';
22
33export type ShikiLang = BundledLanguage | 'text' ;
44
5+ export const DEFAULT_LANG = 'text' as const ;
6+
57export const DEFAULT_LANG_ALIASES : Record < string , ShikiLang > = {
68 abap : 'abap' ,
79 'actionscript-3' : 'actionscript-3' ,
You can’t perform that action at this time.
0 commit comments