0.0.3 • Published 2 years ago

react-highlight-code v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Highlight Code for React

only one prop to show highlightCode using highlight.js

yarn add highlight.js react-highlight-code

live demo

stackblitz highlight demo

1. use in react

Install the react-highlight-code and highlight.js:

import the component and style

import { HighCode } from 'react-highlight-code'
import 'react-highlight-code/dist/style.css'
const value = 'only one prop to show highlightCode using highlight.js'
<HighCode codeValue={value}></HighCode>

BC ~P}8(~@476~S4DTVM99V

VY~~5VUAX 5IGNCE)$ZZ43H

Component Props

propdescriptiontypedefault
codeValueHighlight Code SourceString''
langHighlight Code TypeStringjavascript (such as 'javascript','vue','html','css')
themeComponent Highlight Code themeStringdefault: dark(only 'dark','light')
codeLinesShow Code linesBooleanfalse
langNameHighlight Code Name (Upper left corner display)String
widthcomponent style widthString620px
heightcomponent style heightString
maxWidthcomponent style max-widthString
maxHightcomponent style max-heightStringString200px
fontSizehighlight code font-sizeNumber-
scrollStyleBoolcomponent scroll bar styleBooleantrue
copywhether the code can copy and showBooleantrue