@@ -117,26 +117,22 @@ mdObj.data // => The component source code index object, the sample source
117117``` js
118118{
119119 data: {
120- 17 : {
121- code: " \" use strict\" ;\n\n function ......"
122- language: " jsx"
123- name: 17 ,
124- value: " impo....."
125- },
126120 77 : {
127121 code: " \" use strict\" ;\n\n function ......"
128122 language: " jsx"
129- name: 17 ,
123+ name: 77 ,
124+ meta: {},
130125 value: " impo....."
131126 },
132127 demo12: {
133128 code: " \" use strict\" ;\n\n function ......"
134129 language: " jsx"
135- name: 17 ,
130+ name: ' demo12' ,
131+ meta: {},
136132 value: " impo....."
137133 }
138134 },
139- components: { 17 : ƒ, 77 : ƒ, demo12: ƒ },
135+ components: { 77 : ƒ, demo12: ƒ },
140136 source: " # Alert 确认对话框...."
141137}
142138```
@@ -151,6 +147,8 @@ export type CodeBlockItem = {
151147 language? : string ;
152148 /** The index name, which can be customized, can be a row number. */
153149 name? : string | number ;
150+ /** The `meta` parameter is converted into an `object`. */
151+ meta? : Record <string , string >;
154152};
155153
156154export type CodeBlockData = {
@@ -179,6 +177,44 @@ getMetaId('mdx:preview') // => ''
179177getMetaId (' mdx:preview:demo12' ) // => 'demo12'
180178```
181179
180+ ## getURLParameters
181+
182+ ``` js
183+ import { getURLParameters } from ' markdown-react-code-preview-loader' ;
184+
185+ getURLParameters (' name=Adam&surname=Smith' ) // => { name: 'Adam', surname: "Smith" }
186+ getURLParameters (' mdx:preview:demo12' ) // => { }
187+ getURLParameters (' mdx:preview:demo12&name=Adam&surname=Smith' ) // => { name: 'Adam', surname: "Smith" }
188+ getURLParameters (' mdx:preview:demo12&code=true&boreder=0' ) // => { code: 'true', boreder: "0" }
189+ ```
190+
191+ ``` markdown
192+ \```tsx mdx:preview:demo12&code=true&boreder=0
193+ import React from "react"
194+ const Demo = ()=>{
195+ return <div>测试</div>
196+ }
197+
198+ export default Demo
199+ \```
200+ ```
201+
202+ ``` js
203+ {
204+ data: {
205+ demo12: {
206+ code: " \" use strict\" ;\n\n function ......"
207+ language: " jsx"
208+ name: ' demo12' ,
209+ meta: { code: ' true' , boreder: ' 0' },
210+ value: " impo....."
211+ }
212+ },
213+ components: { demo12: ƒ },
214+ source: " # Alert 确认对话框...."
215+ }
216+ ```
217+
182218## getCodeBlock
183219
184220``` ts
@@ -192,6 +228,7 @@ Note ⚠️: You need to add a special `meta` identifier to the code block examp
1922281 . ` mdx: ` special identifier prefix
1932292 . ` mdx:preview ` Controls whether to perform example indexing, and obtain the required example object through the corresponding line number.
1942303 . ` mdx:preview:demo12 ` Uniquely identified by ` demo12 ` , accurately obtain the ` example code ` or ` example component object ` of the index.
231+ 4 . ` mdx:preview:&code=true&border=0 ` pass the parameters for the rendering layer to use.
195232
196233``` markdown
197234\```tsx mdx:preview
@@ -215,6 +252,17 @@ export default Demo
215252\```
216253```
217254
255+ ``` markdown
256+ \```tsx mdx:preview:demo12&code=true&boreder=0
257+ import React from "react"
258+ const Demo = ()=>{
259+ return <div>测试</div>
260+ }
261+
262+ export default Demo
263+ \```
264+ ```
265+
218266## Development
219267
220268``` bash
0 commit comments