Reimplement MD037/no-space-in-emphasis using micromark tokens, report start/end separately for smaller edit spans, remove markdown-it-texmath (fixes #533, fixes #597).

This commit is contained in:
David Anson 2023-07-24 21:36:55 -07:00
parent e86fb7699d
commit 73b9704159
20 changed files with 1784 additions and 2502 deletions

View file

@ -9,7 +9,6 @@ const md = require("markdown-it")();
const pluginInline = require("markdown-it-for-inline");
const pluginSub = require("markdown-it-sub");
const pluginSup = require("markdown-it-sup");
const pluginTexMath = require("markdown-it-texmath");
const test = require("ava").default;
const tv4 = require("tv4");
const { "exports": packageExports, homepage, version } =
@ -20,11 +19,6 @@ const rules = require("../lib/rules");
const customRules = require("./rules/rules.js");
const configSchema = require("../schema/markdownlint-config-schema.json");
const pluginTexMathOptions = {
"engine": {
"renderToString": () => ""
}
};
const deprecatedRuleNames = new Set(constants.deprecatedRuleNames);
const configSchemaStrict = {
...configSchema,
@ -1104,77 +1098,6 @@ test("markdownItPluginsMultiple", (t) => new Promise((resolve) => {
});
}));
test("markdownItPluginsMathjax", (t) => new Promise((resolve) => {
t.plan(2);
markdownlint({
"strings": {
"string":
"# Heading\n" +
"\n" +
"$1 *2* 3$\n" +
"\n" +
"$$1 *2* 3$$\n" +
"\n" +
"$$1\n" +
"+ 2\n" +
"+ 3$$\n"
},
"markdownItPlugins": [ [ pluginTexMath, pluginTexMathOptions ] ]
}, function callback(err, actual) {
t.falsy(err);
const expected = { "string": [] };
t.deepEqual(actual, expected, "Unexpected issues.");
resolve();
});
}));
test("markdownItPluginsMathjaxIssue166", (t) => new Promise((resolve) => {
t.plan(2);
markdownlint({
"strings": {
"string":
`## Heading
$$
1
$$$$
2
$$\n`
},
"markdownItPlugins": [ [ pluginTexMath, pluginTexMathOptions ] ],
"resultVersion": 0
}, function callback(err, actual) {
t.falsy(err);
const expected = {
"string": {
"MD041": [ 1 ]
}
};
// @ts-ignore
t.deepEqual(actual, expected, "Unexpected issues.");
resolve();
});
}));
test("texmath test files with texmath plugin", (t) => new Promise((resolve) => {
t.plan(2);
markdownlint({
"files": [
"./test/texmath-content-in-lists.md",
"./test/texmath-content-violating-md037.md"
],
"markdownItPlugins": [ [ pluginTexMath, pluginTexMathOptions ] ]
}, function callback(err, actual) {
t.falsy(err);
const expected = {
"./test/texmath-content-in-lists.md": [],
"./test/texmath-content-violating-md037.md": []
};
t.deepEqual(actual, expected, "Unexpected issues.");
resolve();
});
}));
test("Pandoc footnote", (t) => new Promise((resolve) => {
t.plan(2);
markdownlint({