Skip to content

Commit 40d507c

Browse files
committed
build: bump 2.0.0
1 parent 6a36560 commit 40d507c

File tree

2 files changed

+75
-9
lines changed

2 files changed

+75
-9
lines changed

CHANGELOG.md

+74-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,79 @@
1-
# 1.2.6
1+
# 2.0.0
22

3-
- Replace with svg icon
3+
## Features
44

5-
# 1.2.2
5+
### Use @swc/wasm-web instead of babel to compile code in the browser.
66

7-
- Fixed component not rendering when the code property value was updated.
7+
Importing `babel.min.js` on the page will no longer be required. [How it is used in v1](https://github.com/simonguo/react-code-view/blob/1.2.6/README.md#add-babel)
88

9-
# 1.2.0
9+
### Refactored webpack loader for markdown.
1010

11-
- Update dependencies
12-
- _Breaking_ [email protected]
13-
- _Breaking_ [email protected]
11+
```js
12+
13+
// v1
14+
15+
export default {
16+
module: {
17+
rules: [
18+
{
19+
test: /\.md$/,
20+
use: [{
21+
loader: 'html-loader'
22+
}, {
23+
loader: 'markdown-loader',
24+
options: {
25+
renderer: markdownRenderer()
26+
}
27+
}]
28+
}
29+
]
30+
31+
}
32+
};
33+
34+
// v2
35+
export default {
36+
module: {
37+
rules: [
38+
{
39+
test: /\.md$/,
40+
use:[
41+
loader: 'react-code-view/webpack-md-loader',
42+
options:{
43+
parseLanguages: ['typescript','rust']
44+
}
45+
]
46+
}
47+
]
48+
}
49+
};
50+
```
51+
52+
### Props redefined
53+
54+
**v1**
55+
56+
| Name | Type | Default value | Description |
57+
| --------------------- | -------- | ------------------------------------------- | ------------------------------------------------- |
58+
| babelTransformOptions | Object | { presets: ['stage-0', 'react', 'es2015'] } | Babel configuration parameters [options][babeljs] |
59+
| dependencies | Object | | Dependent components. |
60+
| renderToolbar | Function | | Custom toolbar. |
61+
| showCode | boolean | true | Display code. |
62+
| theme | string | 'light' | Theme, options `light` and `dark`. |
63+
64+
**v2**
65+
66+
| Name | Type | Default value | Description |
67+
| -------------- | --------------------------------- | ----------------------- | ------------------------------------------------------------------------- |
68+
| afterCompile | (code: string) => string | | Executed after compiling the code |
69+
| beforeCompile | (code: string) => string | | Executed before compiling the code |
70+
| children | any | | The code to be rendered is executed. Usually imported via markdown-loader |
71+
| compiler | (code: string) => string | | A compiler that transforms the code. Use swc.transformSync by default |
72+
| dependencies | object | | Dependent objects required by the executed code |
73+
| editable | boolean | false | Renders a code editor that can modify the source code |
74+
| editor | object | | Editor properties |
75+
| onChange | (code?: string) => void | | Callback triggered after code change |
76+
| renderToolbar | (buttons: ReactNode) => ReactNode | | Customize the rendering toolbar |
77+
| sourceCode | string | | The code to be rendered is executed |
78+
| theme | 'light' , 'dark' | 'light' | Code editor theme, applied to CodeMirror |
79+
| compileOptions | object | defaultTransformOptions | swc configuration https://swc.rs/docs/configuration/compilation |

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-code-view",
3-
"version": "2.0.0-beta.17",
3+
"version": "2.0.0",
44
"description": "Code view for React",
55
"main": "cjs/index.js",
66
"module": "esm/index.js",

0 commit comments

Comments
 (0)