# xwb-react-markdown

> This is a reference encapsulated Markdown-react plug-in

Latest version **1.2.0** (published 2020-03-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install xwb-react-markdown
pnpm add xwb-react-markdown
yarn add xwb-react-markdown
bun add xwb-react-markdown
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2020-03-10 |
| First published | 2019-09-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 15 |
| Unpacked size | 7.9 MB |
| Known vulnerabilities | 0 (+28 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | xwb007 |
| Maintainers | xwb007 |
| Keywords | react, markdown, react-markdown, xwb-react-markdown |

## Links

- npm: https://www.npmjs.com/package/xwb-react-markdown
- Repository: https://github.com/xwb007/xwb-react-markdown
- Homepage: https://github.com/xwb007/xwb-react-markdown.git
- Issues: https://github.com/xwb007/xwb-react-markdown/issues
- npm.io page: https://npm.io/package/xwb-react-markdown

## Dependencies (15)

- [axios](https://npm.io/package/axios.md) ^0.19.0
- [qiniu](https://npm.io/package/qiniu.md) ^7.3.0
- [react](https://npm.io/package/react.md) ^16.8.1
- [react-dom](https://npm.io/package/react-dom.md) ^16.8.1
- [markdown-it](https://npm.io/package/markdown-it.md) ^8.4.2
- [highlight.js](https://npm.io/package/highlight.js.md) ^9.15.6
- [markdown-it-ins](https://npm.io/package/markdown-it-ins.md) ^2.0.0
- [markdown-it-sub](https://npm.io/package/markdown-it-sub.md) ^1.0.0
- [markdown-it-sup](https://npm.io/package/markdown-it-sup.md) ^1.0.0
- [markdown-it-abbr](https://npm.io/package/markdown-it-abbr.md) ^1.0.4
- [markdown-it-mark](https://npm.io/package/markdown-it-mark.md) ^2.0.0
- [markdown-it-emoji](https://npm.io/package/markdown-it-emoji.md) ^1.4.0
- [markdown-it-deflist](https://npm.io/package/markdown-it-deflist.md) ^2.0.3
- [markdown-it-footnote](https://npm.io/package/markdown-it-footnote.md) ^3.0.1
- [markdown-it-task-lists](https://npm.io/package/markdown-it-task-lists.md) ^2.1.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2020-03-10
- 1.1.9 — 2020-03-10
- 1.1.8 — 2020-03-09
- 1.1.7 — 2019-09-05
- 1.1.6 — 2019-09-05
- 1.1.5 — 2019-09-05
- 1.1.4 — 2019-09-05
- 1.1.3 — 2019-09-05
- 1.1.2 — 2019-09-05
- 1.1.1 — 2019-09-05
- 1.1.0 — 2019-09-05
- 1.0.9 — 2019-09-05
- 1.0.8 — 2019-09-05
- 1.0.7 — 2019-09-05
- 1.0.6 — 2019-09-05
- … 6 more at https://npm.io/package/xwb-react-markdown/versions

## README

# xwb-react-markdown

#### react 集合 Markdown 编辑器

- 一款轻量的基于 React 的 Markdown 编辑器, 压缩后代码只有 72KB
- 支持 TypeScript
- 支持自定义 Markdown 解析器
- 界面可配置, 如只显示编辑区或预览区
- 支持常用的 markdown 编辑功能，如加粗，斜体等等...
- 支持图片上传(自定义服务器地址，基于 axios)
- 支持七牛云图片上传，文件直传，暂时不支持断点续传
- 支持编辑区和预览区同步滚动

### Install

```shell
npm install xwb-react-markdown --save
```

### show-how

- 网页演示 [xwb-react-markdown](https://htmlpreview.github.io/?https://github.com/xwb007/xwb-react-markdown/blob/master/example/index.html)

### git clone

```shell
> git clone https://github.com/xwb007/xwb-react-markdown.git
> npm install
> npm run dev
```

### config

| attribute | value              | type   |
| --------- | ------------------ | ------ |
| value    | 默认值 default null | string |
| height    | height default 300 | number |
| domian    | 七牛云的资源域名 default null  | string |
| token     | 七牛云 token default null      | string |
| uploadUrl | uploadUrl default null       | string |

### example

```js
// example
class Example extends React.Component {
  handleEditorChange = (html, text) => {
    console.log(html);
  };
  render() {
    return <ReactMarkdown handleEditorChange={this.handleEditorChange} />;
  }
}
```

```js
// attr example
// 当上传地址为空时，默认则时把图片转成base64
// 如果使用七牛云上传 则需要自己去获取token 且token和domian不能为空
// domian为你七牛云的资源域名
const config = {
    value:'',
    height: 300,
    domian: "",
    token: "",
    uploadUrl: 'http://0.0.0.0/upload' // 你自己的服务器地址
}
render() {
    return <ReactMarkdown config={config} handleEditorChange={this.handleEditorChange} />;
}
```

---
_Source: https://npm.io/package/xwb-react-markdown · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
