I’m writing a extremely simple markdown-parsing page, when I use marked() of marked.min.js in React component, it only render out string include html tags rather than html tags. Where have I missed?
I have tried to import React-Markdown library, it didn’t work.
You need to use dangerouslySetInnerHTML.
Note that there’s a reason it’s called “dangerous” — it’s a sign that you should only ever use it with trusted content (e.g. you wrote the content yourself) or appropriately sanitized user input (with markedjs, the simplest way to do this is set the
sanitized option to
Thanks bro.There is a quote in Chinese -“好人一生平安”，means “Good people have a good life”.
好好学习天天向上 good good study, day day up