marked-katex-extension 3.0.5 → 4.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/lib/index.cjs CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  var katex = require('katex');
4
4
 
5
- const inlineStartRule = /(?<=\s|^)\${1,2}(?!\$)/;
6
- const inlineRule = /^(\${1,2})(?!\$)((?:\\.|[^\\\n])+?)(?<!\$)\1(?=[\s?!\.,:]|$)/;
5
+ const inlineStartRule = /(\s|^)\${1,2}(?!\$)/;
6
+ const inlineRule = /^(\${1,2})(?!\$)((?:\\.|[^\\\n])*?(?:\\.|[^\\\n\$]))\1(?=[\s?!\.,:]|$)/;
7
7
  const blockRule = /^(\${1,2})\n((?:\\[^]|[^\\])+?)\n\1(?:\n|$)/;
8
8
 
9
9
  function index(options = {}) {
@@ -29,10 +29,11 @@ function inlineKatex(options, renderer) {
29
29
  return;
30
30
  }
31
31
 
32
- const possibleKatex = src.substring(match.index);
32
+ const index = match.index + match[1].length;
33
+ const possibleKatex = src.substring(index);
33
34
 
34
35
  if (possibleKatex.match(inlineRule)) {
35
- return match.index;
36
+ return index;
36
37
  }
37
38
  },
38
39
  tokenizer(src, tokens) {
@@ -54,7 +55,6 @@ function blockKatex(options, renderer) {
54
55
  return {
55
56
  name: 'blockKatex',
56
57
  level: 'block',
57
- start(src) { return src.indexOf('\n$'); },
58
58
  tokenizer(src, tokens) {
59
59
  const match = src.match(blockRule);
60
60
  if (match) {
package/lib/index.umd.js CHANGED
@@ -18409,8 +18409,8 @@
18409
18409
  }
18410
18410
  };
18411
18411
 
18412
- const inlineStartRule = /(?<=\s|^)\${1,2}(?!\$)/;
18413
- const inlineRule = /^(\${1,2})(?!\$)((?:\\.|[^\\\n])+?)(?<!\$)\1(?=[\s?!\.,:]|$)/;
18412
+ const inlineStartRule = /(\s|^)\${1,2}(?!\$)/;
18413
+ const inlineRule = /^(\${1,2})(?!\$)((?:\\.|[^\\\n])*?(?:\\.|[^\\\n\$]))\1(?=[\s?!\.,:]|$)/;
18414
18414
  const blockRule = /^(\${1,2})\n((?:\\[^]|[^\\])+?)\n\1(?:\n|$)/;
18415
18415
 
18416
18416
  function index(options = {}) {
@@ -18436,10 +18436,11 @@
18436
18436
  return;
18437
18437
  }
18438
18438
 
18439
- const possibleKatex = src.substring(match.index);
18439
+ const index = match.index + match[1].length;
18440
+ const possibleKatex = src.substring(index);
18440
18441
 
18441
18442
  if (possibleKatex.match(inlineRule)) {
18442
- return match.index;
18443
+ return index;
18443
18444
  }
18444
18445
  },
18445
18446
  tokenizer(src, tokens) {
@@ -18461,7 +18462,6 @@
18461
18462
  return {
18462
18463
  name: 'blockKatex',
18463
18464
  level: 'block',
18464
- start(src) { return src.indexOf('\n$'); },
18465
18465
  tokenizer(src, tokens) {
18466
18466
  const match = src.match(blockRule);
18467
18467
  if (match) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marked-katex-extension",
3
- "version": "3.0.5",
3
+ "version": "4.0.0",
4
4
  "description": "MarkedJS extesion to render katex",
5
5
  "main": "./lib/index.cjs",
6
6
  "module": "./src/index.js",
@@ -44,31 +44,31 @@
44
44
  "marked": ">=4 <10"
45
45
  },
46
46
  "devDependencies": {
47
- "@babel/core": "^7.22.15",
48
- "@babel/preset-env": "^7.22.15",
47
+ "@babel/core": "^7.23.0",
48
+ "@babel/preset-env": "^7.22.20",
49
49
  "@rollup/plugin-node-resolve": "^15.2.1",
50
50
  "@semantic-release/changelog": "^6.0.3",
51
- "@semantic-release/commit-analyzer": "^10.0.4",
51
+ "@semantic-release/commit-analyzer": "^11.0.0",
52
52
  "@semantic-release/git": "^10.0.1",
53
- "@semantic-release/github": "^9.0.4",
54
- "@semantic-release/npm": "^10.0.5",
55
- "@semantic-release/release-notes-generator": "^11.0.7",
56
- "babel-jest": "^29.6.4",
53
+ "@semantic-release/github": "^9.0.7",
54
+ "@semantic-release/npm": "^11.0.0",
55
+ "@semantic-release/release-notes-generator": "^12.0.0",
56
+ "babel-jest": "^29.7.0",
57
57
  "cheerio": "^1.0.0-rc.12",
58
- "eslint": "^8.48.0",
58
+ "eslint": "^8.50.0",
59
59
  "eslint-config-standard": "^17.1.0",
60
60
  "eslint-plugin-import": "^2.28.1",
61
- "eslint-plugin-n": "^16.0.2",
61
+ "eslint-plugin-n": "^16.1.0",
62
62
  "eslint-plugin-promise": "^6.1.1",
63
- "jest-cli": "^29.6.4",
64
- "marked": "^9.0.0",
63
+ "jest-cli": "^29.7.0",
64
+ "marked": "^9.0.3",
65
65
  "node-fetch": "^3.3.2",
66
- "rollup": "^3.28.1",
67
- "semantic-release": "^21.1.1",
66
+ "rollup": "^3.29.3",
67
+ "semantic-release": "^22.0.5",
68
68
  "tsd": "^0.29.0"
69
69
  },
70
70
  "dependencies": {
71
- "@types/katex": "^0.16.2",
71
+ "@types/katex": "^0.16.3",
72
72
  "katex": "^0.16.8"
73
73
  }
74
74
  }
package/src/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import katex from 'katex';
2
2
 
3
- const inlineStartRule = /(?<=\s|^)\${1,2}(?!\$)/;
4
- const inlineRule = /^(\${1,2})(?!\$)((?:\\.|[^\\\n])+?)(?<!\$)\1(?=[\s?!\.,:]|$)/;
3
+ const inlineStartRule = /(\s|^)\${1,2}(?!\$)/;
4
+ const inlineRule = /^(\${1,2})(?!\$)((?:\\.|[^\\\n])*?(?:\\.|[^\\\n\$]))\1(?=[\s?!\.,:]|$)/;
5
5
  const blockRule = /^(\${1,2})\n((?:\\[^]|[^\\])+?)\n\1(?:\n|$)/;
6
6
 
7
7
  export default function(options = {}) {
@@ -27,10 +27,11 @@ function inlineKatex(options, renderer) {
27
27
  return;
28
28
  }
29
29
 
30
- const possibleKatex = src.substring(match.index);
30
+ const index = match.index + match[1].length;
31
+ const possibleKatex = src.substring(index);
31
32
 
32
33
  if (possibleKatex.match(inlineRule)) {
33
- return match.index;
34
+ return index;
34
35
  }
35
36
  },
36
37
  tokenizer(src, tokens) {
@@ -52,7 +53,6 @@ function blockKatex(options, renderer) {
52
53
  return {
53
54
  name: 'blockKatex',
54
55
  level: 'block',
55
- start(src) { return src.indexOf('\n$'); },
56
56
  tokenizer(src, tokens) {
57
57
  const match = src.match(blockRule);
58
58
  if (match) {