Skip to content

Latest commit

 

History

History
50 lines (37 loc) · 1.08 KB

README.md

File metadata and controls

50 lines (37 loc) · 1.08 KB

react-code-previewer · GitHub license npm version

Doc

react-code-previewer doc

Install

yarn add react-code-previewer
npm install react-code-previewer

Usage

import { CodePreviewer, MdPreviewer, PreviewLayout } from "react-code-previewer";

ReactDOM.render(
  <PreviewLayout>
    <MdPreviewer md={installMd}></MdPreviewer>
    <CodePreviewer code={code} showCode={true}>
      your-component-here
    </CodePreviewer>
    <MdPreviewer md={apiMd}></MdPreviewer>
  </PreviewLayout>,
  mountNode
);

Setting

如果是要引入.md 文件,要在 webpack.config.js 文件加入下面这段代码,如下所示:

yarn add -D raw-loader
npm install -D raw-loader
 rules: [
    {
        test: /\.md$/,
        use: "raw-loader"
    },

contact me

[email protected]