@readme/syntax-highlighter 12.1.1 → 12.1.3

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@readme/syntax-highlighter",
3
3
  "description": "ReadMe's React-based syntax highlighter",
4
- "version": "12.1.1",
4
+ "version": "12.1.3",
5
5
  "main": "dist/index.node.js",
6
6
  "browser": "dist/index.js",
7
7
  "license": "ISC",
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "homepage": "https://readmeio.github.io/syntax-highlighter/",
13
13
  "engines": {
14
- "node": ">=14"
14
+ "node": ">=18"
15
15
  },
16
16
  "scripts": {
17
17
  "build": "webpack --progress",
@@ -20,7 +20,6 @@
20
20
  "prepare": "husky install",
21
21
  "pretest": "npm run lint",
22
22
  "prettier": "prettier --list-different --write \"./**/**.{js,jsx}\"",
23
- "release": "npx conventional-changelog-cli -i CHANGELOG.md -s && git add CHANGELOG.md",
24
23
  "start": "webpack serve --open --config ./webpack.config.dev.js",
25
24
  "test": "jest --coverage --runInBand",
26
25
  "watch": "webpack -w --progress"
@@ -32,40 +31,40 @@
32
31
  "react-codemirror2": "^7.2.1"
33
32
  },
34
33
  "peerDependencies": {
35
- "@readme/variable": "^15.1.0",
34
+ "@readme/variable": "15.x || 16.x",
36
35
  "react": "16.x || 17.x",
37
36
  "react-dom": "16.x || 17.x"
38
37
  },
39
38
  "devDependencies": {
40
- "@babel/preset-env": "^7.21.5",
41
- "@babel/preset-react": "^7.14.5",
42
- "@commitlint/cli": "^17.6.1",
43
- "@commitlint/config-conventional": "^17.6.1",
44
- "@readme/eslint-config": "^10.5.2",
39
+ "@babel/preset-env": "^7.22.20",
40
+ "@babel/preset-react": "^7.22.15",
41
+ "@commitlint/cli": "^17.7.2",
42
+ "@commitlint/config-conventional": "^17.7.0",
43
+ "@readme/eslint-config": "^13.0.1",
45
44
  "@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
46
- "babel-jest": "^29.5.0",
45
+ "babel-jest": "^29.7.0",
47
46
  "babel-loader": "^8.2.4",
48
- "core-js": "^3.30.1",
47
+ "core-js": "^3.33.0",
49
48
  "css-loader": "^6.7.3",
50
49
  "enzyme": "^3.11.0",
51
- "eslint": "^8.39.0",
52
- "glob": "^10.2.2",
53
- "html-webpack-plugin": "^5.5.1",
50
+ "eslint": "^8.50.0",
51
+ "glob": "^10.3.10",
52
+ "html-webpack-plugin": "^5.5.3",
54
53
  "husky": "^8.0.3",
55
54
  "identity-obj-proxy": "^3.0.0",
56
- "jest": "^29.5.0",
57
- "jest-environment-jsdom": "^29.5.0",
58
- "node-sass": "^7.0.3",
59
- "prettier": "^2.8.8",
55
+ "jest": "^29.7.0",
56
+ "jest-environment-jsdom": "^29.7.0",
57
+ "node-sass": "^9.0.0",
58
+ "prettier": "^3.0.3",
60
59
  "react": "^17.0.2",
61
60
  "react-dom": "^17.0.2",
62
- "regenerator-runtime": "^0.13.9",
63
- "sass-loader": "^13.2.2",
61
+ "regenerator-runtime": "^0.14.0",
62
+ "sass-loader": "^13.3.2",
64
63
  "style-loader": "^3.3.2",
65
64
  "terser-webpack-plugin": "^5.3.7",
66
- "webpack": "^5.81.0",
67
- "webpack-cli": "^5.0.2",
68
- "webpack-dev-server": "^4.13.3"
65
+ "webpack": "^5.88.2",
66
+ "webpack-cli": "^5.1.4",
67
+ "webpack-dev-server": "^4.15.1"
69
68
  },
70
69
  "prettier": "@readme/eslint-config/prettier",
71
70
  "commitlint": {
package/public/index.js CHANGED
@@ -164,5 +164,5 @@ ReactDOM.render(
164
164
  {syntaxHighlighter(exampleJson, 'json', { foldGutter: true, readOnly: true, dark: false })}
165
165
  </pre>
166
166
  </div>,
167
- document.getElementById('root')
167
+ document.getElementById('root'),
168
168
  );
@@ -169,9 +169,14 @@ const extractVariables = (code, opts) => {
169
169
  let offsetDelta = 0;
170
170
  const variables = [];
171
171
 
172
- const extracter = ({ length }, capture, offset) => {
172
+ const extracter = (match, capture, offset) => {
173
+ const unescaped = match.replace(/^\\<</, '<<').replace(/\\>>$/, '>>');
174
+ if (unescaped !== match) {
175
+ return unescaped;
176
+ }
177
+
173
178
  variables.push({ text: capture, offset: offset - offsetDelta });
174
- offsetDelta += length;
179
+ offsetDelta += match.length;
175
180
 
176
181
  return '';
177
182
  };
package/src/index.js CHANGED
@@ -18,7 +18,7 @@ const SyntaxHighlighter = (
18
18
  inline: false,
19
19
  tokenizeVariables: false,
20
20
  },
21
- editorProps = {}
21
+ editorProps = {},
22
22
  ) => {
23
23
  let theme = opts.dark ? 'material-palenight' : 'neo';
24
24
  if (opts.customTheme) {
@@ -57,7 +57,7 @@ const SyntaxHighlighter = (
57
57
  return React.createElement(
58
58
  wrapper,
59
59
  { className: classes.join(' ') },
60
- codemirror(typeof code === 'string' ? code : '', lang, opts)
60
+ codemirror(typeof code === 'string' ? code : '', lang, opts),
61
61
  );
62
62
  };
63
63
 
@@ -2,7 +2,6 @@
2
2
  /* eslint-disable prefer-template */
3
3
  /* eslint-disable object-shorthand */
4
4
  /* eslint-disable no-return-assign */
5
- /* eslint-disable unicorn/no-unsafe-regex */
6
5
  /* eslint-disable no-unused-expressions */
7
6
  /* eslint-disable consistent-return */
8
7
  /* eslint-disable no-prototype-builtins */