Skip to content

Commit

Permalink
Remove @iktakahiro/markdown-it-katex dev dependency which warns of 2 …
Browse files Browse the repository at this point in the history
…vulnerabilities on install, tweak markdownItPlugins test cases accordingly.
  • Loading branch information
DavidAnson committed Jan 16, 2025
1 parent 5d000b1 commit 0ef65fc
Show file tree
Hide file tree
Showing 16 changed files with 228 additions and 141 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
},
"devDependencies": {
"@eslint/js": "9.18.0",
"@iktakahiro/markdown-it-katex": "4.0.1",
"@playwright/test": "1.49.1",
"@stylistic/eslint-plugin": "2.13.0",
"ajv": "8.17.1",
Expand Down
21 changes: 11 additions & 10 deletions test/markdownItPlugins/custom-rule-assert-markdown-it-tokens.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check

import { deepEqual } from "node:assert";
import { readFileSync, writeFileSync } from "node:fs";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
import { __dirname } from "../esm-helpers.mjs";

Expand All @@ -23,15 +23,16 @@ export default {
"utf8"
)
);
writeFileSync(
file,
JSON.stringify(
actual,
null,
2
),
"utf8"
);
// Un-comment to update snapshots if markdown-it token output changes
// writeFileSync(
// file,
// JSON.stringify(
// actual,
// null,
// 2
// ),
// "utf8"
// );
deepEqual(actual, expected);
}
};
131 changes: 82 additions & 49 deletions test/markdownItPlugins/multiple.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,31 @@
"nesting": 0,
"level": 0,
"children": null,
"content": "Happy emoji: :smile:",
"content": "Happy emoji:",
"markup": "",
"info": "",
"meta": null,
"block": false,
"hidden": false,
"lineNumber": 3,
"line": "Happy emoji: :smile:"
},
{
"type": "emoji",
"tag": "",
"attrs": null,
"map": null,
"nesting": 0,
"level": 0,
"children": null,
"content": "😄",
"markup": "smile",
"info": "",
"meta": null,
"block": false,
"hidden": false,
"lineNumber": 3,
"line": "Happy emoji: :smile:"
}
],
"content": "Happy emoji: :smile:",
Expand Down Expand Up @@ -235,7 +252,7 @@
"meta": null,
"block": true,
"hidden": false,
"line": "$1 *2* 3$",
"line": "Text [ link ](https://example.com)",
"lineNumber": 7
},
{
Expand All @@ -250,30 +267,86 @@
"level": 1,
"children": [
{
"type": "math_inline",
"tag": "math",
"type": "text",
"tag": "",
"attrs": null,
"map": null,
"nesting": 0,
"level": 0,
"children": null,
"content": "Text",
"markup": "",
"info": "",
"meta": null,
"block": false,
"hidden": false,
"lineNumber": 7,
"line": "Text [ link ](https://example.com)"
},
{
"type": "link_open",
"tag": "a",
"attrs": [
[
"href",
"https://example.com"
]
],
"map": null,
"nesting": 1,
"level": 0,
"children": null,
"content": "",
"markup": "",
"info": "",
"meta": null,
"block": false,
"hidden": false,
"lineNumber": 7,
"line": "Text [ link ](https://example.com)"
},
{
"type": "text",
"tag": "",
"attrs": null,
"map": null,
"nesting": 0,
"level": 1,
"children": null,
"content": "link",
"markup": "",
"info": "",
"meta": null,
"block": false,
"hidden": false,
"lineNumber": 7,
"line": "Text [ link ](https://example.com)"
},
{
"type": "link_close",
"tag": "a",
"attrs": null,
"map": null,
"nesting": -1,
"level": 0,
"children": null,
"content": "1 *2* 3",
"markup": "$",
"content": "",
"markup": "",
"info": "",
"meta": null,
"block": false,
"hidden": false,
"lineNumber": 7,
"line": "$1 *2* 3$"
"line": "Text [ link ](https://example.com)"
}
],
"content": "$1 *2* 3$",
"content": "Text [ link ](https://example.com)",
"markup": "",
"info": "",
"meta": null,
"block": true,
"hidden": false,
"line": "$1 *2* 3$",
"line": "Text [ link ](https://example.com)",
"lineNumber": 7
},
{
Expand All @@ -290,45 +363,5 @@
"meta": null,
"block": true,
"hidden": false
},
{
"type": "math_block",
"tag": "math",
"attrs": null,
"map": [
8,
9
],
"nesting": 0,
"level": 0,
"children": null,
"content": "1 *2* 3\n",
"markup": "$$",
"info": "",
"meta": null,
"block": true,
"hidden": false,
"line": "$$1 *2* 3$$",
"lineNumber": 9
},
{
"type": "math_block",
"tag": "math",
"attrs": null,
"map": [
10,
13
],
"nesting": 0,
"level": 0,
"children": null,
"content": "1\n+ 2\n+ 3",
"markup": "$$",
"info": "",
"meta": null,
"block": true,
"hidden": false,
"line": "$$1",
"lineNumber": 11
}
]
4 changes: 2 additions & 2 deletions test/markdownItPlugins/multiple/.markdownlint-cli2.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"../custom-rule-assert-markdown-it-tokens.mjs"
],
"markdownItPlugins": [
[ "markdown-it-emoji/dist/bare.cjs.js", { "enabled": [ "smile" ] } ],
[ "@iktakahiro/markdown-it-katex" ]
[ "markdown-it-emoji/dist/light.cjs.js", { "enabled": [ "smile" ] } ],
[ "../file/custom-markdown-it-plugin.cjs" ]
]
}
8 changes: 1 addition & 7 deletions test/markdownItPlugins/multiple/emoji.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,5 @@ Happy emoji: :smile:

Sad emoji: :frowning:

$1 *2* 3$

$$1 *2* 3$$

$$1
+ 2
+ 3$$
Text [ link ](https://example.com)

Loading

0 comments on commit 0ef65fc

Please sign in to comment.