import MarkdownIt from 'markdown-it' ; import hljs from 'highlight.js/lib/core' ; import javascript from 'highlight.js/lib/languages/javascript' ; hljs . registerLanguage ( 'javascript' , javascript ) ; import 'highlight.js/styles/github.css' ; const markdownRender = new MarkdownIt ( { html : true , highlight : function ( str , lang ) { if ( lang && hljs . getLanguage ( lang ) ) { try { return hljs . highlight ( lang , str ) . value ; } catch ( __ ) { } } return '' ; } , } ) ; export default markdownRender ;