diff options
author | Michael Muré <batolettre@gmail.com> | 2020-02-14 22:56:59 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-02-14 22:56:59 +0100 |
commit | e9aff2a2a103b43852ecf7b57ae9ab297890eeed (patch) | |
tree | d66cb75151e42ada31e1d0179f8dba0ace388989 /webui/src/Content.tsx | |
parent | b2ca506210b3eb63c4964e5bb47203fd5341ddf4 (diff) | |
parent | 2df72942f2b057956c7873f908b64880ab647331 (diff) | |
download | git-bug-e9aff2a2a103b43852ecf7b57ae9ab297890eeed.tar.gz |
Merge remote-tracking branch 'origin/master' into cheshirekow-jira
Diffstat (limited to 'webui/src/Content.tsx')
-rw-r--r-- | webui/src/Content.tsx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/webui/src/Content.tsx b/webui/src/Content.tsx new file mode 100644 index 00000000..3a7af2f8 --- /dev/null +++ b/webui/src/Content.tsx @@ -0,0 +1,26 @@ +import React from 'react'; +import html from 'remark-html'; +import parse from 'remark-parse'; +import remark2react from 'remark-react'; +import unified from 'unified'; + +import ImageTag from './tag/ImageTag'; +import PreTag from './tag/PreTag'; + +type Props = { markdown: string }; +const Content: React.FC<Props> = ({ markdown }: Props) => { + const processor = unified() + .use(parse) + .use(html) + .use(remark2react, { + remarkReactComponents: { + img: ImageTag, + pre: PreTag, + }, + }); + + const contents: React.ReactNode = processor.processSync(markdown).contents; + return <>{contents}</>; +}; + +export default Content; |