I use Marked library in a React project and would like to set the option "gfm: true" and "breaks: true".
Based on example provided on the official website I think I am doing the right thing but the changes do not appear on my project.
I have put the two solutions below but none of them works.
React.useEffect(() => {
[textToMarkdown(), markdownText]
})
const [markdowned, setMarkdowned] = React.useState("")
const handleChange = (e) => {
setMarkdownText(e.target.value)
textToMarkdown()
}
// https://marked.js.org/using_advanced
marked.setOptions({
gfm: true,
breaks: true,
xhtml: true
});
const textToMarkdown = () => {
setMarkdowned(marked.parse(markdownText, {breaks: true, gfm: true}));
}