Skip to content

Commit

Permalink
doc: Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Oct 24, 2024
1 parent cf77648 commit 2459f09
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
6 changes: 5 additions & 1 deletion core/README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ import webpack, { Configuration } from 'webpack';
import scopePluginOptions from '@kkt/scope-plugin-options';
import { LoaderConfOptions } from 'kkt';

export default (conf: Configuration, env: 'development' | 'production', options: LoaderConfOptions) => {
export default (
conf: Configuration,
env: 'development' | 'production',
options: LoaderConfOptions
) => {
// ....
config.module.rules.forEach((ruleItem) => {
if (typeof ruleItem === 'object') {
Expand Down
28 changes: 21 additions & 7 deletions core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ export default (
import webpack from 'webpack';
import { Options } from 'markdown-react-code-preview-loader';
/**
* `mdCodeModulesLoader` method for adding `markdown-react-code-preview-loader` to webpack config.
* `mdCodeModulesLoader` method for adding
* `markdown-react-code-preview-loader` to webpack config.
*
* @param {webpack.Configuration} config webpack config
* @param {string[]} lang Parsing language
* @param {Options} option Loader Options
Expand All @@ -66,7 +68,11 @@ import webpack, { Configuration } from 'webpack';
import scopePluginOptions from '@kkt/scope-plugin-options';
import { LoaderConfOptions } from 'kkt';

export default (conf: Configuration, env: 'development' | 'production', options: LoaderConfOptions) => {
export default (
conf: Configuration,
env: 'development' | 'production',
options: LoaderConfOptions
) => {
// ....
config.module.rules.forEach((ruleItem) => {
if (typeof ruleItem === 'object') {
Expand Down Expand Up @@ -121,7 +127,8 @@ import mdObj from 'markdown-react-code-preview-loader/README.md';

// `README.md` raw string text
mdObj.source
// The component index object, the React component converted from the markdown indexed example.
// The component index object,
// the React component converted from the markdown indexed example.
// (need to configure meta)
mdObj.components
// The component source code index object, the sample source code indexed from markdown.
Expand Down Expand Up @@ -203,9 +210,13 @@ import { getURLParameters } from 'markdown-react-code-preview-loader';

getURLParameters('name=Adam&surname=Smith') // => { name: 'Adam', surname: "Smith" }
getURLParameters('mdx:preview:demo12') // => { }
getURLParameters('mdx:preview:demo12&name=Adam&surname=Smith') // => { name: 'Adam', surname: "Smith" }
getURLParameters('mdx:preview:demo12&code=true&boreder=0') // => { code: 'true', boreder: "0" }
getURLParameters('mdx:preview:demo12?code=true&boreder=0') // => { code: 'true', boreder: "0" }

getURLParameters('mdx:preview:demo12&name=Adam&surname=Smith')
// => { name: 'Adam', surname: "Smith" }
getURLParameters('mdx:preview:demo12&code=true&boreder=0')
// => { code: 'true', boreder: "0" }
getURLParameters('mdx:preview:demo12?code=true&boreder=0')
// => { code: 'true', boreder: "0" }
```

```markdown
Expand Down Expand Up @@ -238,7 +249,10 @@ export default Demo
## getCodeBlock

```ts
const getCodeBlock: (child: MarkdownParseData['children'], opts?: Options) => CodeBlockData['data'];
const getCodeBlock: (
child: MarkdownParseData['children'],
opts?: Options
) => CodeBlockData['data'];
```

## Configure meta ID
Expand Down

0 comments on commit 2459f09

Please sign in to comment.