Just render few specific html raw elements in react markdown #144
-
Hi, among the html elements, I only want to render ul, li, ol, and p tag when text is given. An other elements like below is how my ReactMarkdown looks like, I want to use only few html tags to render under react markdown. disallowedElements no helps because it hide all the element specified . <ReactMarkdown
disallowedElements={['input', 'textarea', 'script', 'select', 'form']}
remarkPlugins={[remarkMath, remarkBreak, [remarkGfm, { singleTilde: false }]]}
rehypePlugins={[rehypeKatex, [rehypeRaw, {options: ""}]]}
sourcePos
rawSourcePos
includeElementIndex
components={{
// ...
/> below dummy's p tag should be rendered. dummy = \`
<p>hello
</p>
\` below dummy texts should be treated as 'text', not to render dummy = \`
<table>
</table>
<dog>
<data>
\` |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Follow our support guide and use more words to explain your question: https://github.com/rehypejs/.github/blob/main/support.md. |
Beta Was this translation helpful? Give feedback.
-
You can support HTML or you can not support HTML. There is no in between. If you paste the markdown:
On the website, you will see react-markdown is about markdown. Not HTML. Not an XML-like language. Markdown is a language with a spec. Markdown you use here on GH will work similarly to markdown that we support. And markdown in other places. You can’t make a new language with these projects. I think it’s much better if you explain to authors how to write markdown: https://commonmark.org/help/ |
Beta Was this translation helpful? Give feedback.
You can support HTML or you can not support HTML. There is no in between.
If you paste the markdown:
On the website, you will see
<table> </table> <dog> <data>
. https://remarkjs.github.io/react-markdown/. If you want that, use that.react-markdown is about markdown. Not HTML. Not an XML-like language. Markdown is a language with a spec. Markdown you use here on GH will work similarly to markdown that we support. And markdown in other places. You can’t make a new language with these projects. I think it’s much better if you explain to authors how to write markdown: https://commonmark.org/help/