Skip to content

Commit a4501e4

Browse files
committedMar 14, 2018
Update Readme
Sandbox Docs update
1 parent f63da19 commit a4501e4

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed
 

‎README.md

+19-6
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,49 @@
11
# react-highlight
2+
23
React component for syntax highlighting using highlight.js
34

45
![Build Status](https://travis-ci.org/akiran/react-highlight.svg?branch=master)
56

7+
### Latest version
8+
9+
`0.11.1`
10+
11+
### CodeSandbox Example
12+
13+
[![Edit new](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/5kz6kyprxp)
14+
615
### Installation
16+
717
```bash
818
npm install react-highlight --save
919
```
1020

1121
### Usage
22+
1223
#### Importing component
24+
1325
```js
14-
var Highlight = require('react-highlight');
26+
var Highlight = require('react-highlight')
1527
```
1628

1729
#### Adding styles
30+
1831
Choose the [theme](https://highlightjs.org/static/demo/) for syntax highlighting and add corresponding styles of highlight.js
32+
1933
```css
2034
<link rel="stylesheet" href="/path/to/styles/theme-name.css">
2135
```
2236

2337
The styles will most likely be in `node_modules/highlight.js/styles` folder.
2438

2539
Props:
40+
2641
* className: custom class name
2742
* innerHTML: enable to render markup with dangerouslySetInnerHTML
28-
* element: render code snippet inside specified element
43+
* element: render code snippet inside specified element
2944

3045
#### Syntax highlighting of single code snippet
46+
3147
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.
3248

3349
```html
@@ -37,6 +53,7 @@ Code snippet that requires syntax highlighting should be passed as children to H
3753
```
3854

3955
#### Syntax highlighting of mutiple code snippets
56+
4057
Set `innerHTML=true` to highlight multiple code snippets at a time.
4158
This is especially usefull if html with multiple code snippets is generated from preprocesser tools like markdown.
4259

@@ -47,7 +64,3 @@ This is especially usefull if html with multiple code snippets is generated from
4764
{"html with multiple code snippets"}
4865
</Highlight>
4966
```
50-
51-
### Sponsor
52-
53-

0 commit comments

Comments
 (0)
Please sign in to comment.