在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):Thinkmill/react-markings开源软件地址(OpenSource Url):https://github.com/Thinkmill/react-markings开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):MDX, it's the same thing, but betterRecommendation: Use(Although this library may be easier for you to integrate while MDX tools get built) react-markings
import * as React from 'react';
import md from 'react-markings';
function Example() {
return (
<pre>
<code>...</code>
</pre>
);
}
export default function ReadMe() {
return md`
# react-markings
> Markdown in components, components in markdown
- Allows you to write markdown using [commonmark.js](https://github.com/commonmark/commonmark.js)
- Renders markdown as React elements using [commonmark-react-renderer](https://github.com/rexxars/commonmark-react-renderer)
- Embed React components inside your markdown (in any paragraph position) like this:
${<Example/>}
`;
} If you want to customize rendering further, you can use import * as React from 'react';
import md from 'react-markings';
let customMd = md.customize({
renderers: {
// customize heading with class
heading: props => React.createElement('h' + props.level, { className: 'fancy-heading' }, props.children),
},
});
export default function CustomHeading() {
return customMd`
# Fancy Heading
`;
} |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论