akiran/react-highlight
소개
구문 강조를 위한 React 컴포넌트
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Originalreact-highlight
React component for syntax highlighting using highlight.js
Latest version
0.11.1
Documentation
CodeSandbox Example
Installation
npm install react-highlight --save
Usage
Importing component
import Highlight from 'react-highlight'
Adding styles
Choose the theme for syntax highlighting and add corresponding styles of highlight.js
<link rel="stylesheet" href="/path/to/styles/theme-name.css">
The styles will most likely be in node_modules/highlight.js/styles folder.
Props:
- className: custom class name
- innerHTML: enable to render markup with dangerouslySetInnerHTML
- element: render code snippet inside specified element
Syntax highlighting of single code snippet
Code snippet that requires syntax highlighting should be passed as children to Highlight component in string format. Language name of code snippet should be specified as className.
<Highlight className='language-name-of-snippet'>
{"code snippet to be highlighted"}
</Highlight>
Syntax highlighting of mutiple code snippets
Set innerHTML=true to highlight multiple code snippets at a time.
This is especially usefull if html with multiple code snippets is generated from preprocesser tools like markdown.
Warning: If innerHTML is set to true, make sure the html generated with code snippets is from trusted source.
<Highlight innerHTML={true}>
{"html with multiple code snippets"}
</Highlight>
관련 프로젝트 살펴보기
불러오는 중…