fix: Provide p tag override to avoid md parsing errors

Signed-off-by: Raul Kele <raulkeleblk@gmail.com>
This commit is contained in:
Raul Kele 2022-11-21 12:53:25 +02:00
parent acf75ba2b6
commit 0bdf816bdc

View File

@ -1,12 +1,19 @@
import React from 'react'; import React from 'react';
import Markdown from 'markdown-to-jsx'; import Markdown from 'markdown-to-jsx';
// used to override p tags in compiled md
const ParagraphOverride = ({ children, ...props }) => <span {...props}>{children}</span>;
const MarkdownWrapper = (props) => { const MarkdownWrapper = (props) => {
const { children, options } = props; const { children, options } = props;
return ( return (
<Markdown <Markdown
{...props} {...props}
options={{ ...options, disableParsingRawHTML: true, overrides: { a: { props: { target: '_blank' } } } }} options={{
...options,
disableParsingRawHTML: true,
overrides: { p: { component: ParagraphOverride }, a: { props: { target: '_blank' } } }
}}
> >
{children} {children}
</Markdown> </Markdown>