Skip to content

Commit db97bf7

Browse files
committed
update readme
1 parent b64754a commit db97bf7

File tree

2 files changed

+124
-81
lines changed

2 files changed

+124
-81
lines changed

README.md

Lines changed: 124 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@
33

44
Syntax highlighting component for `React Native` using <a href='https://github.com/conorhastings/react-syntax-highlighter'> `react-syntax-highlighter`</a>
55

6+
### With Highlight.js vdom
67
<img src='./react-native-syntax-highlighter.gif' />
78

9+
### With Prism vdom
10+
<img src='./react-native-syntax-highlighter-prism.gif' />
11+
12+
813
You can try it out with <a href='https://expo.io'>Expo</a> <a href='https://expo.io/@conor/test-native-syntax'>here</a>
914

1015
### Install
@@ -15,16 +20,24 @@ You can try it out with <a href='https://expo.io'>Expo</a> <a href='https://expo
1520
### Use
1621

1722
#### props
18-
Accepts all of the same props as <a href='https://github.com/conorhastings/react-syntax-highlighter'> `react-syntax-highlighter`</a> with two additional props.
23+
Accepts all of the same props as <a href='https://github.com/conorhastings/react-syntax-highlighter'> `react-syntax-highlighter`</a> with three additional props.
1924
* `fontFamily` - the font family to use for syntax text.
2025
* `fontSize` - the fontSize for syntax text.
26+
* `highligter` - defaults to rendering with vdom created from highlightjs, but can pass in `prism` as alternate option. You can see more about dealing with the prism highlighter in the docs for <a href='https://github.com/conorhastings/react-syntax-highlighter'>react-syntax-highlighter</a> but one of the main uses would be better support for jsx
2127

2228
```js
2329
import SyntaxHighlighter from 'react-native-syntax-highlighter';
24-
import { docco } from 'react-syntax-highlighter/dist/styles';
30+
/*by default component uses hljs so access hljs styles, import from /prism for prism styles */
31+
import { docco } from 'react-syntax-highlighter/styles/hljs';
2532
const Component = () => {
2633
const codeString = '(num) => num + 1';
27-
return <SyntaxHighlighter language='javascript' style={docco}>{codeString}</SyntaxHighlighter>;
34+
return <SyntaxHighlighter
35+
language='javascript'
36+
style={docco}
37+
highlighter={"prism" || "hljs"}
38+
>
39+
{codeString}
40+
</SyntaxHighlighter>;
2841
}
2942
```
3043

@@ -37,83 +50,113 @@ Some of the react-syntax-highlighter props are not currently supported by the mo
3750
- lineNumberContainerStyle
3851
- lineNumberStyle
3952

40-
### Styles Available
41-
42-
- agate
43-
- androidstudio
44-
- arduinoLight
45-
- arta
46-
- ascetic
47-
- atelierCaveDark
48-
- atelierCaveLight
49-
- atelierDuneDark
50-
- atelierDuneLight
51-
- atelierEstuaryDark
52-
- atelierEstuaryLight
53-
- atelierForestDark
54-
- atelierForestLight
55-
- atelierHeathDark
56-
- atelierHeathLight
57-
- atelierLakesideDark
58-
- atelierLakesideLight
59-
- atelierPlateauDark
60-
- atelierPlateauLight
61-
- atelierSavannaDark
62-
- atelierSavannaLight
63-
- atelierSeasideDark
64-
- atelierSeasideLight
65-
- atelierSulphurpoolDark
66-
- atelierSurphulpoolLight
67-
- atomOneDark
68-
- atomOneLight
69-
- brownPaper
70-
- codepenEmbed
71-
- colorBrewer
72-
- dark
73-
- darkula
74-
- defaultStyle
75-
- docco
76-
- dracula
77-
- far
78-
- foundation
79-
- githubGist
80-
- github
81-
- googlecode
82-
- grayscale
83-
- gruvboxDark
84-
- gruvboxLight
85-
- hopscotch
86-
- hybrid
87-
- idea
88-
- irBlack
89-
- kimbieDark
90-
- kimbieLight
91-
- magula
92-
- monoBlue
93-
- monokaiSublime
94-
- monokai
95-
- obsidian
96-
- ocean
97-
- paraisoDark
98-
- paraisoLight
99-
- pojoaque
100-
- purebasic
101-
- qtcreatorDark
102-
- qtcreatorLight
103-
- railscasts
104-
- rainbow
105-
- schoolBook
106-
- solarizedDark
107-
- solarizedLight
108-
- sunburst
109-
- tomorrowNightBlue
110-
- tomorrowNightBright
111-
- tomorrowNightEighties
112-
- tomorrowNight
113-
- tomorrow
114-
- vs
115-
- xcode
116-
- xt256
117-
- zenburn
53+
### Styles Available -- hljs
54+
55+
* agate
56+
* androidstudio
57+
* arduinoLight
58+
* arta
59+
* ascetic
60+
* atelierCaveDark
61+
* atelierCaveLight
62+
* atelierDuneDark
63+
* atelierDuneLight
64+
* atelierEstuaryDark
65+
* atelierEstuaryLight
66+
* atelierForestDark
67+
* atelierForestLight
68+
* atelierHeathDark
69+
* atelierHeathLight
70+
* atelierLakesideDark
71+
* atelierLakesideLight
72+
* atelierPlateauDark
73+
* atelierPlateauLight
74+
* atelierSavannaDark
75+
* atelierSavannaLight
76+
* atelierSeasideDark
77+
* atelierSeasideLight
78+
* atelierSulphurpoolDark
79+
* atelierSulphurpoolLight
80+
* atomOneDark
81+
* atomOneLight
82+
* brownPaper
83+
* codepenEmbed
84+
* colorBrewer
85+
* darcula
86+
* dark
87+
* darkula
88+
* defaultStyle
89+
* docco
90+
* dracula
91+
* far
92+
* foundation
93+
* githubGist
94+
* github
95+
* googlecode
96+
* grayscale
97+
* gruvboxDark
98+
* gruvboxLight
99+
* hopscotch
100+
* hybrid
101+
* idea
102+
* irBlack
103+
* kimbieDark
104+
* kimbieLight
105+
* magula
106+
* monoBlue
107+
* monokaiSublime
108+
* monokai
109+
* obsidian
110+
* ocean
111+
* paraisoDark
112+
* paraisoLight
113+
* pojoaque
114+
* purebasic
115+
* qtcreatorDark
116+
* qtcreatorLight
117+
* railscasts
118+
* rainbow
119+
* routeros
120+
* schoolBook
121+
* solarizedDark
122+
* solarizedLight
123+
* sunburst
124+
* tomorrowNightBlue
125+
* tomorrowNightBright
126+
* tomorrowNightEighties
127+
* tomorrowNight
128+
* tomorrow
129+
* vs
130+
* vs2015
131+
* xcode
132+
* xt256
133+
* zenburn
134+
135+
### Styles Available -- prism
136+
137+
* coy
138+
* dark
139+
* funky
140+
* okaidia
141+
* solarizedlight
142+
* tomorrow
143+
* twilight
144+
* prism
145+
* atomDark
146+
* base16AteliersulphurpoolLight
147+
* cb
148+
* darcula
149+
* duotoneDark
150+
* duotoneEarth
151+
* duotoneForest
152+
* duotoneLight
153+
* duotoneSea
154+
* duotoneSpace
155+
* ghcolors
156+
* hopscotch
157+
* pojoaque
158+
* vs
159+
* xonokai
160+
118161

119162

4.19 MB
Loading

0 commit comments

Comments
 (0)