在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):jerolimov/react-showdown开源软件地址(OpenSource Url):https://github.com/jerolimov/react-showdown开源编程语言(OpenSource Language):TypeScript 98.6%开源软件介绍(OpenSource Introduction):react-showdown
Features
Installationnpm install --save react-showdown or yarn add react-showdown Use as React componentExample with ES6/JSX: import React from 'react';
import MarkdownView from 'react-showdown';
export default function App() {
const markdown = `
# Welcome to React Showdown :+1:
To get started, edit the markdown in \`example/src/App.tsx\`.
| Column 1 | Column 2 |
|----------|----------|
| A1 | B1 |
| A2 | B2 |
`;
return (
<MarkdownView
markdown={markdown}
options={{ tables: true, emoji: true }}
/>
);
}; Use a React component and use it within the markdown with ES6 / TypeScript: import MarkdownView from 'react-showdown';
function CustomComponent({ name }: { name: string }) {
return <span>Hello {name}!</span>;
}
const markdown = `
# A custom component:
<CustomComponent name="world" />`;
<MarkdownView markdown={markdown} components={{ CustomComponent }} /> Available props
Converter options will be pushed forward to the showdown converter, please checkout the valid options section. CreditsProject is based on the markdown parser Showdown and the html parser htmlparser2. Alternatives
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论