diff --git a/package.json b/package.json index 6d2e2ee..f8fda51 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/test/markdownItPlugins/custom-rule-assert-markdown-it-tokens.mjs b/test/markdownItPlugins/custom-rule-assert-markdown-it-tokens.mjs index d70cab7..ae04897 100644 --- a/test/markdownItPlugins/custom-rule-assert-markdown-it-tokens.mjs +++ b/test/markdownItPlugins/custom-rule-assert-markdown-it-tokens.mjs @@ -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"; @@ -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); } }; diff --git a/test/markdownItPlugins/multiple.json b/test/markdownItPlugins/multiple.json index 3baffa4..415fab2 100644 --- a/test/markdownItPlugins/multiple.json +++ b/test/markdownItPlugins/multiple.json @@ -111,7 +111,7 @@ "nesting": 0, "level": 0, "children": null, - "content": "Happy emoji: :smile:", + "content": "Happy emoji:", "markup": "", "info": "", "meta": null, @@ -119,6 +119,23 @@ "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:", @@ -235,7 +252,7 @@ "meta": null, "block": true, "hidden": false, - "line": "$1 *2* 3$", + "line": "Text [ link ](https://example.com)", "lineNumber": 7 }, { @@ -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 }, { @@ -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 } ] \ No newline at end of file diff --git a/test/markdownItPlugins/multiple/.markdownlint-cli2.jsonc b/test/markdownItPlugins/multiple/.markdownlint-cli2.jsonc index 9e0705f..6900153 100644 --- a/test/markdownItPlugins/multiple/.markdownlint-cli2.jsonc +++ b/test/markdownItPlugins/multiple/.markdownlint-cli2.jsonc @@ -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" ] ] } diff --git a/test/markdownItPlugins/multiple/emoji.md b/test/markdownItPlugins/multiple/emoji.md index a6db2c4..2660455 100644 --- a/test/markdownItPlugins/multiple/emoji.md +++ b/test/markdownItPlugins/multiple/emoji.md @@ -4,11 +4,5 @@ Happy emoji: :smile: Sad emoji: :frowning: -$1 *2* 3$ - -$$1 *2* 3$$ - -$$1 -+ 2 -+ 3$$ +Text [ link ](https://example.com) diff --git a/test/markdownItPlugins/single.json b/test/markdownItPlugins/single.json index 3baffa4..94e1380 100644 --- a/test/markdownItPlugins/single.json +++ b/test/markdownItPlugins/single.json @@ -111,7 +111,7 @@ "nesting": 0, "level": 0, "children": null, - "content": "Happy emoji: :smile:", + "content": "Happy emoji: ", "markup": "", "info": "", "meta": null, @@ -119,6 +119,23 @@ "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:", @@ -184,7 +201,7 @@ "nesting": 0, "level": 0, "children": null, - "content": "Sad emoji: :frowning:", + "content": "Sad emoji: ", "markup": "", "info": "", "meta": null, @@ -192,6 +209,23 @@ "hidden": false, "lineNumber": 5, "line": "Sad emoji: :frowning:" + }, + { + "type": "emoji", + "tag": "", + "attrs": null, + "map": null, + "nesting": 0, + "level": 0, + "children": null, + "content": "😦", + "markup": "frowning", + "info": "", + "meta": null, + "block": false, + "hidden": false, + "lineNumber": 5, + "line": "Sad emoji: :frowning:" } ], "content": "Sad emoji: :frowning:", @@ -235,7 +269,7 @@ "meta": null, "block": true, "hidden": false, - "line": "$1 *2* 3$", + "line": "Text [ link ](https://example.com)", "lineNumber": 7 }, { @@ -250,30 +284,86 @@ "level": 1, "children": [ { - "type": "math_inline", - "tag": "math", + "type": "text", + "tag": "", "attrs": null, "map": null, "nesting": 0, "level": 0, "children": null, - "content": "1 *2* 3", - "markup": "$", + "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": "$1 *2* 3$" + "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": "", + "markup": "", + "info": "", + "meta": null, + "block": false, + "hidden": false, + "lineNumber": 7, + "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 }, { @@ -290,45 +380,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 } ] \ No newline at end of file diff --git a/test/markdownItPlugins/single/.markdownlint-cli2.jsonc b/test/markdownItPlugins/single/.markdownlint-cli2.jsonc index 246bdf8..7e1d66c 100644 --- a/test/markdownItPlugins/single/.markdownlint-cli2.jsonc +++ b/test/markdownItPlugins/single/.markdownlint-cli2.jsonc @@ -8,6 +8,6 @@ "../custom-rule-assert-markdown-it-tokens.mjs" ], "markdownItPlugins": [ - [ "@iktakahiro/markdown-it-katex" ] + [ "markdown-it-emoji/dist/light.cjs.js" ] ] } diff --git a/test/markdownItPlugins/single/emoji.md b/test/markdownItPlugins/single/emoji.md index a6db2c4..2660455 100644 --- a/test/markdownItPlugins/single/emoji.md +++ b/test/markdownItPlugins/single/emoji.md @@ -4,11 +4,5 @@ Happy emoji: :smile: Sad emoji: :frowning: -$1 *2* 3$ - -$$1 *2* 3$$ - -$$1 -+ 2 -+ 3$$ +Text [ link ](https://example.com) diff --git a/test/markdownlint-cli2-jsonc-example/.markdownlint-cli2.jsonc b/test/markdownlint-cli2-jsonc-example/.markdownlint-cli2.jsonc index 78c83ae..579e873 100644 --- a/test/markdownlint-cli2-jsonc-example/.markdownlint-cli2.jsonc +++ b/test/markdownlint-cli2-jsonc-example/.markdownlint-cli2.jsonc @@ -34,7 +34,7 @@ // Use a plugin to recognize math "markdownItPlugins": [ - [ "@iktakahiro/markdown-it-katex" ] + [ "markdown-it-emoji/dist/light.cjs.js" ] ], // Additional paths to resolve module locations from diff --git a/test/markdownlint-cli2-yaml-example/.markdownlint-cli2.yaml b/test/markdownlint-cli2-yaml-example/.markdownlint-cli2.yaml index bb9823d..f101fee 100644 --- a/test/markdownlint-cli2-yaml-example/.markdownlint-cli2.yaml +++ b/test/markdownlint-cli2-yaml-example/.markdownlint-cli2.yaml @@ -31,7 +31,7 @@ ignores: # Use a plugin to recognize math markdownItPlugins: - - - "@iktakahiro/markdown-it-katex" + - "markdown-it-emoji/dist/light.cjs.js" # Additional paths to resolve module locations from modulePaths: diff --git a/test/snapshots/markdownlint-cli2-test-exec.mjs.md b/test/snapshots/markdownlint-cli2-test-exec.mjs.md index 0c50933..11e45f5 100644 --- a/test/snapshots/markdownlint-cli2-test-exec.mjs.md +++ b/test/snapshots/markdownlint-cli2-test-exec.mjs.md @@ -2837,14 +2837,18 @@ Generated by [AVA](https://avajs.dev). module/link.md:3:12 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ multiple/emoji.md:3:15 MD044/proper-names Proper names should have the correct capitalization [Expected: SMILE; Actual: smile]␊ multiple/emoji.md:5:13 MD044/proper-names Proper names should have the correct capitalization [Expected: FROWNING; Actual: frowning]␊ - multiple/emoji.md:15 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]␊ + multiple/emoji.md:7:7 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ + multiple/emoji.md:7:12 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ + multiple/emoji.md:9 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]␊ pre-imported/link.md:3:7 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ pre-imported/link.md:3:12 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ - single/emoji.md:15 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]`, + single/emoji.md:7:7 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ + single/emoji.md:7:12 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ + single/emoji.md:9 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]`, stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊ Finding: **/*.md␊ Linting: 6 file(s)␊ - Summary: 12 error(s)`, + Summary: 16 error(s)`, } ## markdownItPlugins-missing (exec) diff --git a/test/snapshots/markdownlint-cli2-test-exec.mjs.snap b/test/snapshots/markdownlint-cli2-test-exec.mjs.snap index fb5d83b..2a2c1c3 100644 Binary files a/test/snapshots/markdownlint-cli2-test-exec.mjs.snap and b/test/snapshots/markdownlint-cli2-test-exec.mjs.snap differ diff --git a/test/snapshots/markdownlint-cli2-test-fs.mjs.md b/test/snapshots/markdownlint-cli2-test-fs.mjs.md index d76a9c2..0a2914a 100644 --- a/test/snapshots/markdownlint-cli2-test-fs.mjs.md +++ b/test/snapshots/markdownlint-cli2-test-fs.mjs.md @@ -2366,15 +2366,19 @@ Generated by [AVA](https://avajs.dev). module/link.md:3:12 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ multiple/emoji.md:3:15 MD044/proper-names Proper names should have the correct capitalization [Expected: SMILE; Actual: smile]␊ multiple/emoji.md:5:13 MD044/proper-names Proper names should have the correct capitalization [Expected: FROWNING; Actual: frowning]␊ - multiple/emoji.md:15 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]␊ + multiple/emoji.md:7:7 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ + multiple/emoji.md:7:12 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ + multiple/emoji.md:9 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]␊ pre-imported/link.md:3:7 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ pre-imported/link.md:3:12 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ - single/emoji.md:15 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]␊ + single/emoji.md:7:7 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ + single/emoji.md:7:12 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ + single/emoji.md:9 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]␊ `, stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊ Finding: **/*.md␊ Linting: 6 file(s)␊ - Summary: 12 error(s)␊ + Summary: 16 error(s)␊ `, } diff --git a/test/snapshots/markdownlint-cli2-test-fs.mjs.snap b/test/snapshots/markdownlint-cli2-test-fs.mjs.snap index ad8442e..1ee69c9 100644 Binary files a/test/snapshots/markdownlint-cli2-test-fs.mjs.snap and b/test/snapshots/markdownlint-cli2-test-fs.mjs.snap differ diff --git a/test/snapshots/markdownlint-cli2-test-main.mjs.md b/test/snapshots/markdownlint-cli2-test-main.mjs.md index 1696784..59d8abf 100644 --- a/test/snapshots/markdownlint-cli2-test-main.mjs.md +++ b/test/snapshots/markdownlint-cli2-test-main.mjs.md @@ -3038,15 +3038,19 @@ Generated by [AVA](https://avajs.dev). module/link.md:3:12 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ multiple/emoji.md:3:15 MD044/proper-names Proper names should have the correct capitalization [Expected: SMILE; Actual: smile]␊ multiple/emoji.md:5:13 MD044/proper-names Proper names should have the correct capitalization [Expected: FROWNING; Actual: frowning]␊ - multiple/emoji.md:15 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]␊ + multiple/emoji.md:7:7 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ + multiple/emoji.md:7:12 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ + multiple/emoji.md:9 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]␊ pre-imported/link.md:3:7 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ pre-imported/link.md:3:12 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ - single/emoji.md:15 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]␊ + single/emoji.md:7:7 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ + single/emoji.md:7:12 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ + single/emoji.md:9 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]␊ `, stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊ Finding: **/*.md␊ Linting: 6 file(s)␊ - Summary: 12 error(s)␊ + Summary: 16 error(s)␊ `, } @@ -5466,15 +5470,19 @@ Generated by [AVA](https://avajs.dev). module/link.md:3:12 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ multiple/emoji.md:3:15 MD044/proper-names Proper names should have the correct capitalization [Expected: SMILE; Actual: smile]␊ multiple/emoji.md:5:13 MD044/proper-names Proper names should have the correct capitalization [Expected: FROWNING; Actual: frowning]␊ - multiple/emoji.md:15 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]␊ + multiple/emoji.md:7:7 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ + multiple/emoji.md:7:12 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ + multiple/emoji.md:9 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]␊ pre-imported/link.md:3:7 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ pre-imported/link.md:3:12 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ - single/emoji.md:15 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]␊ + single/emoji.md:7:7 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ + single/emoji.md:7:12 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊ + single/emoji.md:9 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]␊ `, stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊ Finding: **/*.md␊ Linting: 6 file(s)␊ - Summary: 12 error(s)␊ + Summary: 16 error(s)␊ `, } diff --git a/test/snapshots/markdownlint-cli2-test-main.mjs.snap b/test/snapshots/markdownlint-cli2-test-main.mjs.snap index 90f39ef..69b0c4f 100644 Binary files a/test/snapshots/markdownlint-cli2-test-main.mjs.snap and b/test/snapshots/markdownlint-cli2-test-main.mjs.snap differ