You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See the [CodeMirror API Docs](https://codemirror.net/doc/manual.html#api) for the available options.
67
67
68
+
### Using Language Modes
69
+
70
+
Several [language modes](https://codemirror.net/mode/) are included with CodeMirror for syntax hilighting.
71
+
72
+
By default (to optimise bundle size) all modes are not included. To enable syntax hilighting:
73
+
74
+
* install the `codemirror` package dependency (in addition to `react-codemirror`)
75
+
* require the language modes you wish to make available _after_ you require `react-codemirror` itself
76
+
* set the `mode` option in the `options` object
77
+
78
+
```js
79
+
var React =require('react');
80
+
var Codemirror =require('react-codemirror');
81
+
require('codemirror/mode/javascript/javascript');
82
+
require('codemirror/mode/xml/xml');
83
+
require('codemirror/mode/markdown/markdown');
84
+
85
+
<Codemirror ... options={{
86
+
mode:'javascript'
87
+
}} />
88
+
```
89
+
90
+
See the [example source](https://github.com/JedWatson/react-codemirror/blob/master/example/src/example.js) for a reference implementation including JavaScript and markdown syntax hilighting.
0 commit comments