@readme/syntax-highlighter 12.1.5 → 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 CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "presets": [
3
- ["@babel/preset-env", {
4
- "targets": {
5
- "browsers": ["last 2 versions"]
3
+ [
4
+ "@babel/preset-env",
5
+ {
6
+ "targets": {
7
+ "browsers": ["last 2 versions"]
8
+ }
6
9
  }
7
- }],
10
+ ],
8
11
  "@babel/preset-react"
9
12
  ]
10
13
  }
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2020, ReadMe
1
+ Copyright (c) 2024, ReadMe
2
2
 
3
3
  Permission to use, copy, modify, and/or distribute this software for any purpose
4
4
  with or without fee is hereby granted, provided that the above copyright notice
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