Closed hshe closed 8 months ago
@hshe Provide an example that reproduces the error and I can help you take a look
"past this content
" to https://uiwjs.github.io/react-markdown-preview/
F12 show the error logs add last char '>' then crash @jaywcjlove
contains element <div ref .....
example
import MarkdownPreview from '@uiw/react-markdown-preview';
const source = `
\`\`\`js {2}
function () {
console.log('hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello')
}
\`\`\`
\`\`\`js {2}
function () {
console.log('hello ')
}
joker <div ref={endRef} /> 3
\`\`\`
joker <div ref/> 3
`;
export default function Demo() {
return (
<MarkdownPreview
source={source}
/>
);
}
@hshe This is a problem caused by rehype-raw
, Here is a solution:
<MarkdownPreview
pluginsFilter={(type, plugin) => {
if (type === "rehype") {
let data = plugin.filter((item) => {
if (typeof item === 'function' && item.name === "rehypeRaw") {
return false;
}
return true;
});
return data;
}
return plugin;
}}
className="editor-preview"
source={value}
/>
Thank you @jaywcjlove
throw error