Skip to content

Commit

Permalink
build: bump 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
simonguo committed Jul 7, 2022
1 parent 6a36560 commit 40d507c
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 9 deletions.
82 changes: 74 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,79 @@
# 1.2.6
# 2.0.0

- Replace with svg icon
## Features

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

- Fixed component not rendering when the code property value was updated.
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)

# 1.2.0
### Refactored webpack loader for markdown.

- Update dependencies
- _Breaking_ react-markdown-reader@1.2.0
- _Breaking_ markdown-loader@5.0.0
```js

// v1

export default {
module: {
rules: [
{
test: /\.md$/,
use: [{
loader: 'html-loader'
}, {
loader: 'markdown-loader',
options: {
renderer: markdownRenderer()
}
}]
}
]

}
};

// v2
export default {
module: {
rules: [
{
test: /\.md$/,
use:[
loader: 'react-code-view/webpack-md-loader',
options:{
parseLanguages: ['typescript','rust']
}
]
}
]
}
};
```

### Props redefined

**v1**

| Name | Type | Default value | Description |
| --------------------- | -------- | ------------------------------------------- | ------------------------------------------------- |
| babelTransformOptions | Object | { presets: ['stage-0', 'react', 'es2015'] } | Babel configuration parameters [options][babeljs] |
| dependencies | Object | | Dependent components. |
| renderToolbar | Function | | Custom toolbar. |
| showCode | boolean | true | Display code. |
| theme | string | 'light' | Theme, options `light` and `dark`. |

**v2**

| Name | Type | Default value | Description |
| -------------- | --------------------------------- | ----------------------- | ------------------------------------------------------------------------- |
| afterCompile | (code: string) => string | | Executed after compiling the code |
| beforeCompile | (code: string) => string | | Executed before compiling the code |
| children | any | | The code to be rendered is executed. Usually imported via markdown-loader |
| compiler | (code: string) => string | | A compiler that transforms the code. Use swc.transformSync by default |
| dependencies | object | | Dependent objects required by the executed code |
| editable | boolean | false | Renders a code editor that can modify the source code |
| editor | object | | Editor properties |
| onChange | (code?: string) => void | | Callback triggered after code change |
| renderToolbar | (buttons: ReactNode) => ReactNode | | Customize the rendering toolbar |
| sourceCode | string | | The code to be rendered is executed |
| theme | 'light' , 'dark' | 'light' | Code editor theme, applied to CodeMirror |
| compileOptions | object | defaultTransformOptions | swc configuration https://swc.rs/docs/configuration/compilation |
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-code-view",
"version": "2.0.0-beta.17",
"version": "2.0.0",
"description": "Code view for React",
"main": "cjs/index.js",
"module": "esm/index.js",
Expand Down

0 comments on commit 40d507c

Please sign in to comment.