UNPKG

@aws-northstar/ui

Version:
17 lines (16 loc) 743 B
import { jsx as _jsx } from "react/jsx-runtime"; import gfm from 'remark-gfm'; import frontmatter from 'remark-frontmatter'; import ReactMarkdown from 'react-markdown'; import TextContent from '@cloudscape-design/components/text-content'; import Link from '@cloudscape-design/components/link'; const components = { a: (props) => (_jsx(Link, { href: props.href, target: "_black", external: true, children: props.children })), }; /** * MarkdownViewer renders content with Markdown format. */ const MarkdownViewer = ({ children, ...props }) => { return (_jsx(TextContent, { ...props, children: _jsx(ReactMarkdown, { remarkPlugins: [gfm, frontmatter], components: components, children: children }) })); }; export default MarkdownViewer;