I use react-markdown to build a virtual DOM, which allows only updating the changed DOM instead of a complete rewrite. It generates content in
tags. I want to add
tag inside tag.
<ReactMarkdown components={ { code({ node, inline, className, children, ...props }) { const match = /language-(\w+)/.exec(className || ''); return !inline && match ? ( <SyntaxHighlighter {...props} style={a11yDark} language={match[1]} PreTag="div" > {String(children).replace(/\n$/, '')} </SyntaxHighlighter> ) : ( <code {...props} className={className}> {children} </code> ); }, }} > {content} </ReactMarkdown>
A custom rendering function may be used for the paragraph node type. I'm not sure, but it might help.