marked-katex-extension 2.0.2 → 2.1.1

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.umd.js CHANGED
@@ -96,13 +96,19 @@
96
96
  * about where in the source string the problem occurred.
97
97
  */
98
98
  class ParseError {
99
- // Error position based on passed-in Token or ParseNode.
99
+ // Error start position based on passed-in Token or ParseNode.
100
+ // Length of affected text based on passed-in Token or ParseNode.
101
+ // The underlying error message without any context added.
100
102
  constructor(message, // The error message
101
103
  token // An object providing position information
102
104
  ) {
105
+ this.name = void 0;
103
106
  this.position = void 0;
107
+ this.length = void 0;
108
+ this.rawMessage = void 0;
104
109
  var error = "KaTeX parse error: " + message;
105
110
  var start;
111
+ var end;
106
112
  var loc = token && token.loc;
107
113
 
108
114
  if (loc && loc.start <= loc.end) {
@@ -111,7 +117,7 @@
111
117
  var input = loc.lexer.input; // Prepend some information
112
118
 
113
119
  start = loc.start;
114
- var end = loc.end;
120
+ end = loc.end;
115
121
 
116
122
  if (start === input.length) {
117
123
  error += " at end of input: ";
@@ -141,14 +147,20 @@
141
147
  error += left + underlined + right;
142
148
  } // Some hackery to make ParseError a prototype of Error
143
149
  // See http://stackoverflow.com/a/8460753
150
+ // $FlowFixMe
144
151
 
145
152
 
146
153
  var self = new Error(error);
147
154
  self.name = "ParseError"; // $FlowFixMe
148
155
 
149
- self.__proto__ = ParseError.prototype; // $FlowFixMe
150
-
156
+ self.__proto__ = ParseError.prototype;
151
157
  self.position = start;
158
+
159
+ if (start != null && end != null) {
160
+ self.length = end - start;
161
+ }
162
+
163
+ self.rawMessage = message;
152
164
  return self;
153
165
  }
154
166
 
@@ -18303,7 +18315,7 @@
18303
18315
  /**
18304
18316
  * Current KaTeX version
18305
18317
  */
18306
- version: "0.16.7",
18318
+ version: "0.16.8",
18307
18319
 
18308
18320
  /**
18309
18321
  * Renders the given LaTeX into an HTML+MathML combination, and adds
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "marked-katex-extension",
3
- "version": "2.0.2",
3
+ "version": "2.1.1",
4
4
  "description": "MarkedJS extesion to render katex",
5
5
  "main": "./lib/index.cjs",
6
6
  "module": "./src/index.js",
7
7
  "browser": "./lib/index.umd.js",
8
8
  "type": "module",
9
+ "types": "./src/index.d.ts",
9
10
  "keywords": [
10
11
  "marked",
11
12
  "katex",
@@ -24,6 +25,7 @@
24
25
  "scripts": {
25
26
  "test": "jest --verbose",
26
27
  "test:cover": "jest --coverage",
28
+ "test:types": "tsd -f spec/index.test-d.ts -t src/index.d.ts",
27
29
  "lint": "eslint .",
28
30
  "build": "rollup -c rollup.config.js"
29
31
  },
@@ -41,27 +43,30 @@
41
43
  "marked": "^4 || ^5"
42
44
  },
43
45
  "devDependencies": {
44
- "@babel/core": "^7.21.5",
45
- "@babel/preset-env": "^7.21.5",
46
- "@rollup/plugin-node-resolve": "^15.0.2",
46
+ "@babel/core": "^7.22.5",
47
+ "@babel/preset-env": "^7.22.5",
48
+ "@rollup/plugin-node-resolve": "^15.1.0",
47
49
  "@semantic-release/changelog": "^6.0.3",
48
- "@semantic-release/commit-analyzer": "^9.0.2",
50
+ "@semantic-release/commit-analyzer": "^10.0.1",
49
51
  "@semantic-release/git": "^10.0.1",
50
- "@semantic-release/github": "^8.0.7",
51
- "@semantic-release/npm": "^10.0.3",
52
- "@semantic-release/release-notes-generator": "^11.0.1",
52
+ "@semantic-release/github": "^9.0.3",
53
+ "@semantic-release/npm": "^10.0.4",
54
+ "@semantic-release/release-notes-generator": "^11.0.3",
55
+ "@types/marked": "^5.0.0",
53
56
  "babel-jest": "^29.5.0",
54
- "eslint": "^8.39.0",
55
- "eslint-config-standard": "^17.0.0",
57
+ "eslint": "^8.43.0",
58
+ "eslint-config-standard": "^17.1.0",
56
59
  "eslint-plugin-import": "^2.27.5",
57
- "eslint-plugin-n": "^15.7.0",
60
+ "eslint-plugin-n": "^16.0.1",
58
61
  "eslint-plugin-promise": "^6.1.1",
59
62
  "jest-cli": "^29.5.0",
60
- "marked": "^4.3.0",
61
- "rollup": "^3.21.2",
62
- "semantic-release": "^21.0.2"
63
+ "marked": "^5.0.4",
64
+ "rollup": "^3.25.3",
65
+ "semantic-release": "^21.0.5",
66
+ "tsd": "^0.28.1"
63
67
  },
64
68
  "dependencies": {
65
- "katex": "^0.16.7"
69
+ "@types/katex": "^0.16.0",
70
+ "katex": "^0.16.8"
66
71
  }
67
72
  }
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export default function markedKatex(options?: import('katex').KatexOptions): import('marked').marked.MarkedExtension