fix: Provide p tag override to avoid md parsing errors
Signed-off-by: Raul Kele <raulkeleblk@gmail.com>
This commit is contained in:
parent
acf75ba2b6
commit
0bdf816bdc
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user