importReactfrom'react';importparseMarkdownfrom'github-style-markdown';constMyComponent=()=>{constmarkdownText=` # Hello, world! This is **bold** and this is *italic*. > This is a quote. `;consthtmlText=parseMarkdown(markdownText);return(<divdangerouslySetInnerHTML={{__html: htmlText}}/>);};exportdefaultMyComponent;
In Vanilla JS, call it by
constparseMarkdown=require('github-style-markdown');constmarkdownText=`# Hello, world!This is **bold** and this is *italic*.> This is a quote.`;consthtmlText=parseMarkdown(markdownText);console.log(htmlText);