1. Introducemarked

package.json

"dependencies": {
    "marked": "^0.3.9"
}
import marked from "marked";
  1. How to modify the generated HTML
const renderer = new marked.Renderer();
//https://github.com/markedjs/marked/issues/655#issuecomment-383226346
const linkRenderer = renderer.link;
renderer.link = (href, title, text) => {
    const html = linkRenderer.call(renderer, href, title, text);
    return html.replace(/^<a /, '<a target="_blank" rel="nofollow" ');
};
const html = marked(markdown, { renderer });
Tips: market parameter configuration
const renderer = new marked.Renderer();
//Basic settings
marked.setOptions({
    renderer: renderer,
    GFM: true, // allow git hub standard markdown.
    Tables: true, // table syntax is allowed (this option requires GFM to be true)
    Breaks: true, // allow carriage return to wrap (this option requires GFM to be true)
    Pedantic: false, // do not correct any bad behaviors and errors of the original model (default is false)
    Sanitize: false, // filter (clean) the output, ignoring any HTML code (tags) that has been entered
    Smartlists: true, // use a more fashionable list than the native markdown
    Smartypants: false // use more fashionable punctuation
});