语法高亮组件react-syntax-highlighter
- github: https://github.com/react-syntax-highlighter/react-syntax-highlighter
- star: 2.8K
- Weekly Downloads: 4,293,242
- demo: https://react-syntax-highlighter.github.io/react-syntax-highlighter/demo/
- Install
npm install react-syntax-highlighter --save
- 使用
import { Light as SyntaxHighlighter } from 'react-syntax-highlighter';
import js from 'react-syntax-highlighter/dist/esm/languages/hljs/javascript';
import docco from 'react-syntax-highlighter/dist/esm/styles/hljs/docco';
SyntaxHighlighter.registerLanguage('javascript', js);