File tree Expand file tree Collapse file tree 5 files changed +123
-16
lines changed
examples/nextjs/src/app/docs Expand file tree Collapse file tree 5 files changed +123
-16
lines changed File renamed without changes.
Original file line number Diff line number Diff line change 5050 "r18gs" : " ^3.0.1" ,
5151 "react-live" : " ^4.1.8" ,
5252 "react18-loaders" : " workspace:*" ,
53+ "rehype-raw" : " ^7.0.0" ,
5354 "typingfx" : " ^1.1.1"
5455 }
5556}
Original file line number Diff line number Diff line change 11.docs {
2- /* create your container styles here */
2+ max-width : 800px ;
3+ margin : auto ;
34}
Original file line number Diff line number Diff line change @@ -4,7 +4,10 @@ import readme from "../../../../../README.md?raw"
44import { Md } from "@m2d/react-markdown" ;
55import { toDocx } from "mdast2docx" ;
66import { AstArrayElement } from "@m2d/react-markdown/utils" ;
7+ import rehypeRaw from "rehype-raw" ;
8+ import rebrandingConfig from "@repo/scripts/rebrand.config.json" ;
79
10+ const { packageName } = rebrandingConfig ;
811export interface DocsProps extends HTMLProps < HTMLDivElement > {
912 children ?: ReactNode ;
1013}
@@ -22,19 +25,20 @@ export const Docs = (props: DocsProps) => {
2225 const url = URL . createObjectURL ( docxBlob as Blob ) ;
2326 const a = document . createElement ( "a" ) ;
2427 a . href = url ;
25- a . download = "document .docx" ;
28+ a . download = ` ${ packageName } .docx` ;
2629 document . body . appendChild ( a ) ;
2730 a . click ( ) ;
2831 document . body . removeChild ( a ) ;
2932 URL . revokeObjectURL ( url ) ;
30- } ) . catch ( ( ) => {
33+ } ) . catch ( ( err ) => {
34+ console . error ( err )
3135 alert ( "Something went wrong!" )
3236 } ) ;
3337 } else {
3438 alert ( "Something went wrong!" )
3539 }
3640 } } > Download as Docx</ button >
37- < Md astRef = { astRef } > { readme } </ Md >
41+ < Md astRef = { astRef } rehypePlugins = { [ rehypeRaw ] } > { readme } </ Md >
3842 </ div >
3943 ) ;
4044}
You can’t perform that action at this time.
0 commit comments