import React, { useEffect, useRef, useState } from 'react' import './index.less' import hljs from 'highlight.js' type CodeHighlightProps = { lang?: string value: string style?: React.CSSProperties } const CodeHighlight: React.FC = (props) => { const { lang = 'plaintext', value, style } = props const dom = useRef(null) useEffect(() => { const res = hljs.highlight(value, {language: lang}) dom.current!.innerHTML = res.value }, [value, lang]) return (
            
        
) } export default CodeHighlight