Content.js

 1import unified from 'unified';
 2import parse from 'remark-parse';
 3import html from 'remark-html';
 4import remark2react from 'remark-react';
 5import ImageTag from './tag/ImageTag';
 6import PreTag from './tag/PreTag';
 7
 8const Content = ({ markdown }) => {
 9  const processor = unified()
10    .use(parse)
11    .use(html)
12    .use(remark2react, {
13      remarkReactComponents: {
14        img: ImageTag,
15        pre: PreTag,
16      },
17    });
18
19  return processor.processSync(markdown).contents;
20};
21
22export default Content;