Skip to content

Commit 0ef65fc

Browse files
committed
Remove @iktakahiro/markdown-it-katex dev dependency which warns of 2 vulnerabilities on install, tweak markdownItPlugins test cases accordingly.
1 parent 5d000b1 commit 0ef65fc

16 files changed

+228
-141
lines changed

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
},
8484
"devDependencies": {
8585
"@eslint/js": "9.18.0",
86-
"@iktakahiro/markdown-it-katex": "4.0.1",
8786
"@playwright/test": "1.49.1",
8887
"@stylistic/eslint-plugin": "2.13.0",
8988
"ajv": "8.17.1",

test/markdownItPlugins/custom-rule-assert-markdown-it-tokens.mjs

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// @ts-check
22

33
import { deepEqual } from "node:assert";
4-
import { readFileSync, writeFileSync } from "node:fs";
4+
import { readFileSync } from "node:fs";
55
import { resolve } from "node:path";
66
import { __dirname } from "../esm-helpers.mjs";
77

@@ -23,15 +23,16 @@ export default {
2323
"utf8"
2424
)
2525
);
26-
writeFileSync(
27-
file,
28-
JSON.stringify(
29-
actual,
30-
null,
31-
2
32-
),
33-
"utf8"
34-
);
26+
// Un-comment to update snapshots if markdown-it token output changes
27+
// writeFileSync(
28+
// file,
29+
// JSON.stringify(
30+
// actual,
31+
// null,
32+
// 2
33+
// ),
34+
// "utf8"
35+
// );
3536
deepEqual(actual, expected);
3637
}
3738
};

test/markdownItPlugins/multiple.json

+82-49
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,31 @@
111111
"nesting": 0,
112112
"level": 0,
113113
"children": null,
114-
"content": "Happy emoji: :smile:",
114+
"content": "Happy emoji:",
115115
"markup": "",
116116
"info": "",
117117
"meta": null,
118118
"block": false,
119119
"hidden": false,
120120
"lineNumber": 3,
121121
"line": "Happy emoji: :smile:"
122+
},
123+
{
124+
"type": "emoji",
125+
"tag": "",
126+
"attrs": null,
127+
"map": null,
128+
"nesting": 0,
129+
"level": 0,
130+
"children": null,
131+
"content": "😄",
132+
"markup": "smile",
133+
"info": "",
134+
"meta": null,
135+
"block": false,
136+
"hidden": false,
137+
"lineNumber": 3,
138+
"line": "Happy emoji: :smile:"
122139
}
123140
],
124141
"content": "Happy emoji: :smile:",
@@ -235,7 +252,7 @@
235252
"meta": null,
236253
"block": true,
237254
"hidden": false,
238-
"line": "$1 *2* 3$",
255+
"line": "Text [ link ](https://example.com)",
239256
"lineNumber": 7
240257
},
241258
{
@@ -250,30 +267,86 @@
250267
"level": 1,
251268
"children": [
252269
{
253-
"type": "math_inline",
254-
"tag": "math",
270+
"type": "text",
271+
"tag": "",
272+
"attrs": null,
273+
"map": null,
274+
"nesting": 0,
275+
"level": 0,
276+
"children": null,
277+
"content": "Text",
278+
"markup": "",
279+
"info": "",
280+
"meta": null,
281+
"block": false,
282+
"hidden": false,
283+
"lineNumber": 7,
284+
"line": "Text [ link ](https://example.com)"
285+
},
286+
{
287+
"type": "link_open",
288+
"tag": "a",
289+
"attrs": [
290+
[
291+
"href",
292+
"https://example.com"
293+
]
294+
],
295+
"map": null,
296+
"nesting": 1,
297+
"level": 0,
298+
"children": null,
299+
"content": "",
300+
"markup": "",
301+
"info": "",
302+
"meta": null,
303+
"block": false,
304+
"hidden": false,
305+
"lineNumber": 7,
306+
"line": "Text [ link ](https://example.com)"
307+
},
308+
{
309+
"type": "text",
310+
"tag": "",
255311
"attrs": null,
256312
"map": null,
257313
"nesting": 0,
314+
"level": 1,
315+
"children": null,
316+
"content": "link",
317+
"markup": "",
318+
"info": "",
319+
"meta": null,
320+
"block": false,
321+
"hidden": false,
322+
"lineNumber": 7,
323+
"line": "Text [ link ](https://example.com)"
324+
},
325+
{
326+
"type": "link_close",
327+
"tag": "a",
328+
"attrs": null,
329+
"map": null,
330+
"nesting": -1,
258331
"level": 0,
259332
"children": null,
260-
"content": "1 *2* 3",
261-
"markup": "$",
333+
"content": "",
334+
"markup": "",
262335
"info": "",
263336
"meta": null,
264337
"block": false,
265338
"hidden": false,
266339
"lineNumber": 7,
267-
"line": "$1 *2* 3$"
340+
"line": "Text [ link ](https://example.com)"
268341
}
269342
],
270-
"content": "$1 *2* 3$",
343+
"content": "Text [ link ](https://example.com)",
271344
"markup": "",
272345
"info": "",
273346
"meta": null,
274347
"block": true,
275348
"hidden": false,
276-
"line": "$1 *2* 3$",
349+
"line": "Text [ link ](https://example.com)",
277350
"lineNumber": 7
278351
},
279352
{
@@ -290,45 +363,5 @@
290363
"meta": null,
291364
"block": true,
292365
"hidden": false
293-
},
294-
{
295-
"type": "math_block",
296-
"tag": "math",
297-
"attrs": null,
298-
"map": [
299-
8,
300-
9
301-
],
302-
"nesting": 0,
303-
"level": 0,
304-
"children": null,
305-
"content": "1 *2* 3\n",
306-
"markup": "$$",
307-
"info": "",
308-
"meta": null,
309-
"block": true,
310-
"hidden": false,
311-
"line": "$$1 *2* 3$$",
312-
"lineNumber": 9
313-
},
314-
{
315-
"type": "math_block",
316-
"tag": "math",
317-
"attrs": null,
318-
"map": [
319-
10,
320-
13
321-
],
322-
"nesting": 0,
323-
"level": 0,
324-
"children": null,
325-
"content": "1\n+ 2\n+ 3",
326-
"markup": "$$",
327-
"info": "",
328-
"meta": null,
329-
"block": true,
330-
"hidden": false,
331-
"line": "$$1",
332-
"lineNumber": 11
333366
}
334367
]

test/markdownItPlugins/multiple/.markdownlint-cli2.jsonc

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"../custom-rule-assert-markdown-it-tokens.mjs"
1515
],
1616
"markdownItPlugins": [
17-
[ "markdown-it-emoji/dist/bare.cjs.js", { "enabled": [ "smile" ] } ],
18-
[ "@iktakahiro/markdown-it-katex" ]
17+
[ "markdown-it-emoji/dist/light.cjs.js", { "enabled": [ "smile" ] } ],
18+
[ "../file/custom-markdown-it-plugin.cjs" ]
1919
]
2020
}

test/markdownItPlugins/multiple/emoji.md

+1-7
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,5 @@ Happy emoji: :smile:
44

55
Sad emoji: :frowning:
66

7-
$1 *2* 3$
8-
9-
$$1 *2* 3$$
10-
11-
$$1
12-
+ 2
13-
+ 3$$
7+
Text [ link ](https://example.com)
148

0 commit comments

Comments
 (0)