3.2.3 • Published 4 years ago
vite-plugin-react-mdrender v3.2.3
使用文档
安装
yarn add vite-plugin-react-mdrender
使用
在vite-config.ts
中引入
const mdRender from 'vite-plugin-react-mdrender'
{
plugins: [ mdRender() ]
}
在 vite global.d.ts 文件加入
declare module '*.md';
markdown 书写要求
- 常规 markdown 语法
- 代码片段(jsx/tsx)
markdown 文件(demo.md)
## 这是一个 title
<demo src="./demo.jsx" />
import React from 'react';
const Demo = () => {
return <div>这是一个demo</div>;
};
export default Demo;
加载 markdown 文件
import Md from 'demo.md';
const App = () => {
return <Md />;
};