@readme/syntax-highlighter 12.1.3 → 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +7 -4
- package/LICENSE +1 -1
- package/README.md +11 -7
- package/dist/index.js +1 -1
- package/dist/index.node.js +1 -1
- package/package.json +22 -33
- package/public/index.js +6 -4
- package/public/index.legacy.js +169 -0
- package/src/codeMirror/index.jsx +2 -1
- package/src/index.js +1 -1
- package/webpack.config.dev.js +1 -1
- package/lib/enzyme.js +0 -16
package/.babelrc
CHANGED
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -13,19 +13,23 @@ npm install --save @readme/syntax-highlighter
|
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
16
|
+
|
|
16
17
|
### Read Only Mode
|
|
18
|
+
|
|
17
19
|
```js
|
|
18
20
|
const syntaxHighlighter = require('@readme/syntax-highlighter');
|
|
19
21
|
const ele = syntaxHighlighter('console.log("Hello, world!");', 'js');
|
|
20
22
|
```
|
|
21
23
|
|
|
22
24
|
### Read Only with Line Numbers
|
|
25
|
+
|
|
23
26
|
```js
|
|
24
27
|
const syntaxHighlighter = require('@readme/syntax-highlighter');
|
|
25
28
|
const ele = syntaxHighlighter('console.log("Hello, world!");', 'js', { ...opts, highlightMode: true });
|
|
26
29
|
```
|
|
27
30
|
|
|
28
31
|
### Read Only with Line Numbers and Highlighted Ranges
|
|
32
|
+
|
|
29
33
|
```js
|
|
30
34
|
const syntaxHighlighter = require('@readme/syntax-highlighter');
|
|
31
35
|
const ele = syntaxHighlighter('console.log("Hello, world!");', 'js', {
|
|
@@ -41,19 +45,17 @@ const ele = syntaxHighlighter('console.log("Hello, world!");', 'js', {
|
|
|
41
45
|
```
|
|
42
46
|
|
|
43
47
|
### Full CodeMirror
|
|
48
|
+
|
|
44
49
|
Access to a full code Mirror instance. See configuration settings in the [`react-codemirror2` library][react-codemirror#props]
|
|
45
50
|
|
|
46
51
|
```js
|
|
47
52
|
const syntaxHighlighter = require('@readme/syntax-highlighter');
|
|
48
|
-
const ele = syntaxHighlighter(
|
|
49
|
-
'console.log("Hello, world!");',
|
|
50
|
-
'js',
|
|
51
|
-
{ ...opts, editable: true },
|
|
52
|
-
{ ...editorProps }
|
|
53
|
-
);
|
|
53
|
+
const ele = syntaxHighlighter('console.log("Hello, world!");', 'js', { ...opts, editable: true }, { ...editorProps });
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
### Available Options
|
|
57
|
+
|
|
58
|
+
<!-- prettier-ignore-start -->
|
|
57
59
|
| Name | Type | Description |
|
|
58
60
|
| :--- | :--- | :--- |
|
|
59
61
|
| `customTheme` | String | Highlighting theme. One of `neo`, `material-palenight`, or `tomorrow-night`. (Setting this will override the `dark` mode option.)
|
|
@@ -63,9 +65,11 @@ const ele = syntaxHighlighter(
|
|
|
63
65
|
| `inline` | String | Wrap code in a `<span>` tag, instead of a `<div>`. |
|
|
64
66
|
| `ranges` | Array | Ranges of line numbers to apply highlighting to. Requires `highlightMode` enabled |
|
|
65
67
|
| `tokenizeVariables` | Boolean | Match and render [ReadMe variables](rdme-variable) in your markdown. |
|
|
68
|
+
<!-- prettier-ignore-end -->
|
|
66
69
|
|
|
67
70
|
## Languages Supported
|
|
68
71
|
|
|
72
|
+
<!-- prettier-ignore-start -->
|
|
69
73
|
| Language | Available language mode(s) |
|
|
70
74
|
| :--- | :--- |
|
|
71
75
|
| ASP.NET | `asp`, `aspx` |
|
|
@@ -110,7 +114,7 @@ const ele = syntaxHighlighter(
|
|
|
110
114
|
| TOML | `toml` |
|
|
111
115
|
| TypeScript | `ts`, `typescript` |
|
|
112
116
|
| YAML | `yaml`, `yml` |
|
|
113
|
-
|
|
117
|
+
<!-- prettier-ignore-end -->
|
|
114
118
|
|
|
115
119
|
[rdme-variable]: https://github.com/readmeio/api-explorer/tree/next/packages/variable
|
|
116
120
|
[codemirror]: https://github.com/codemirror/CodeMirror
|