You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched issues and couldn’t find anything (or linked relevant results below)
Affected packages and versions
react-markdown@9.0.1
Link to runnable example
No response
Steps to reproduce
I want to add a custom syntax, which is warped by :::tip::: and :::/tip:::,will render by my custom component. But, it is not working. My demo code is blow
functioncustomInfoPlugin(){return(tree)=>{lettipOpen=false;lettipNode=null;visit(tree,'text',(node)=>{constvalue=node.value.trim();if(value===':::tip:::'){if(!tipOpen){tipOpen=true;tipNode={type: 'tip',children: [],value: ''};node.value='';// Clear the opening tag}else{thrownewError('Nested tips are not allowed.');}}elseif(value===':::/tip:::'){if(tipOpen){tipOpen=false;node.value='';// Clear the closing tagtree.children[0].children.splice(tree.children.indexOf(node.parent),1,tipNode);}else{thrownewError('Closing tip without opening.');}}elseif(tipOpen){tipNode.value=value;}});};}<ReactMarkdownremarkPlugins={[RemarkBreaksas()=>undefined,customInfoPlugin]}components={{tip: (infoProps)=>{return<div>=====test=====</div>;},}asany}>{`:::tip::: This is a custom tip! :::/tip:::`}</ReactMarkdown>
Expected behavior
The content warped by :::tip::: and :::/tip::: will render by tip component.
Actual behavior
It was rendered as text.
Runtime
No response
Package manager
No response
OS
No response
Build and bundle tools
No response
The text was updated successfully, but these errors were encountered:
Welcome @fengliner! 👋
The markdown doesn't have a tip node type, so it doesn't know what to do with your custom node and skips it.
I think you are looking for data hName and hProperties which influence the HTML output/components.
Initial checklist
Affected packages and versions
react-markdown@9.0.1
Link to runnable example
No response
Steps to reproduce
I want to add a custom syntax, which is warped by :::tip::: and :::/tip:::,will render by my custom component. But, it is not working. My demo code is blow
Expected behavior
The content warped by :::tip::: and :::/tip::: will render by tip component.
Actual behavior
It was rendered as text.
Runtime
No response
Package manager
No response
OS
No response
Build and bundle tools
No response
The text was updated successfully, but these errors were encountered: