Skip to content

zhangwei900808/react-code-previewer

Repository files navigation

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

zw900808@gmail.com