@storm-software/markdownlint 0.12.7 → 0.13.0
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/README.md +1 -1
- package/dist/chunk-5BKT4CS5.js +32 -0
- package/dist/chunk-A3UDIEI3.mjs +32 -0
- package/dist/chunk-BLA57FQS.mjs +68 -0
- package/dist/chunk-CSEVGJXW.js +68 -0
- package/dist/chunk-KF4NZASG.mjs +26 -0
- package/dist/chunk-T2GN3E2Q.js +73 -0
- package/dist/chunk-T5XN24SU.mjs +73 -0
- package/dist/chunk-UP2FAX2A.mjs +58 -0
- package/dist/chunk-ZD5PYAVS.js +58 -0
- package/dist/chunk-ZPSREAWV.js +26 -0
- package/dist/index.d.mts +126 -0
- package/dist/index.d.ts +126 -0
- package/dist/index.js +154 -0
- package/dist/index.mjs +154 -0
- package/dist/rules/rules/index.d.mts +5 -0
- package/dist/rules/rules/index.d.ts +5 -0
- package/dist/rules/rules/index.js +10 -0
- package/dist/rules/rules/index.mjs +10 -0
- package/dist/rules/rules/no-default-alt-text.d.mts +5 -0
- package/dist/rules/rules/no-default-alt-text.d.ts +5 -0
- package/dist/rules/rules/no-default-alt-text.js +5 -0
- package/dist/rules/rules/no-default-alt-text.mjs +5 -0
- package/dist/rules/rules/no-empty-alt-text.d.mts +2 -0
- package/dist/rules/rules/no-empty-alt-text.d.ts +2 -0
- package/dist/rules/rules/no-empty-alt-text.js +5 -0
- package/dist/rules/rules/no-empty-alt-text.mjs +5 -0
- package/dist/rules/rules/no-generic-link-text.d.mts +2 -0
- package/dist/rules/rules/no-generic-link-text.d.ts +2 -0
- package/dist/rules/rules/no-generic-link-text.js +5 -0
- package/dist/rules/rules/no-generic-link-text.mjs +5 -0
- package/package.json +97 -1
- package/.markdownlint.json +0 -155
- package/CHANGELOG.md +0 -163
- package/index.js +0 -252
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
|
|
|
21
21
|
|
|
22
22
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
23
23
|
|
|
24
|
-
[](https://prettier.io/) [](http://nx.dev/) [](https://nextjs.org/) [](http://commitizen.github.io/cz-cli/)  [](https://fumadocs.vercel.app/) 
|
|
25
25
|
|
|
26
26
|
<!-- prettier-ignore-start -->
|
|
27
27
|
<!-- markdownlint-disable -->
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
exports.__name = __name; exports.__commonJS = __commonJS; exports.__toESM = __toESM;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
__name,
|
|
30
|
+
__commonJS,
|
|
31
|
+
__toESM
|
|
32
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__commonJS,
|
|
3
|
+
__name
|
|
4
|
+
} from "./chunk-A3UDIEI3.mjs";
|
|
5
|
+
|
|
6
|
+
// src/rules/no-generic-link-text.ts
|
|
7
|
+
var require_no_generic_link_text = __commonJS({
|
|
8
|
+
"src/rules/no-generic-link-text.ts"(exports, module) {
|
|
9
|
+
function stripAndDowncaseText(text) {
|
|
10
|
+
return text.toLowerCase().replace(/[.,/#!$%^&*;:{}=\-_`~()]/g, "").replace(/\s+/g, " ").trim();
|
|
11
|
+
}
|
|
12
|
+
__name(stripAndDowncaseText, "stripAndDowncaseText");
|
|
13
|
+
var bannedLinkText = [
|
|
14
|
+
"read more",
|
|
15
|
+
"learn more",
|
|
16
|
+
"more",
|
|
17
|
+
"here",
|
|
18
|
+
"click here",
|
|
19
|
+
"link"
|
|
20
|
+
];
|
|
21
|
+
module.exports = {
|
|
22
|
+
names: [
|
|
23
|
+
"SSW02",
|
|
24
|
+
"no-generic-link-text"
|
|
25
|
+
],
|
|
26
|
+
description: "Avoid using generic link text like `Learn more` or `Click here`",
|
|
27
|
+
information: new URL("https://github.com/github/markdownlint-github/blob/main/docs/rules/GH002-no-generic-link-text.md"),
|
|
28
|
+
tags: [
|
|
29
|
+
"accessibility",
|
|
30
|
+
"links"
|
|
31
|
+
],
|
|
32
|
+
function: /* @__PURE__ */ __name(function SS002(params, onError) {
|
|
33
|
+
let bannedLinkTexts = bannedLinkText.concat(params.config.additional_banned_texts || []);
|
|
34
|
+
const exceptions = params.config.exceptions || [];
|
|
35
|
+
if (exceptions.length > 0) {
|
|
36
|
+
bannedLinkTexts = bannedLinkTexts.filter((text) => !exceptions.includes(text));
|
|
37
|
+
}
|
|
38
|
+
const inlineTokens = params.tokens.filter((t) => t.type === "inline");
|
|
39
|
+
for (const token of inlineTokens) {
|
|
40
|
+
const { children } = token;
|
|
41
|
+
let inLink = false;
|
|
42
|
+
let linkText = "";
|
|
43
|
+
for (const child of children) {
|
|
44
|
+
const { content, type } = child;
|
|
45
|
+
if (type === "link_open") {
|
|
46
|
+
inLink = true;
|
|
47
|
+
linkText = "";
|
|
48
|
+
} else if (type === "link_close") {
|
|
49
|
+
inLink = false;
|
|
50
|
+
if (bannedLinkTexts.includes(stripAndDowncaseText(linkText))) {
|
|
51
|
+
onError({
|
|
52
|
+
lineNumber: child.lineNumber,
|
|
53
|
+
detail: `For link: ${linkText}`
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
} else if (inLink) {
|
|
57
|
+
linkText += content;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}, "SS002")
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
require_no_generic_link_text
|
|
68
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunk5BKT4CS5js = require('./chunk-5BKT4CS5.js');
|
|
5
|
+
|
|
6
|
+
// src/rules/no-generic-link-text.ts
|
|
7
|
+
var require_no_generic_link_text = _chunk5BKT4CS5js.__commonJS.call(void 0, {
|
|
8
|
+
"src/rules/no-generic-link-text.ts"(exports, module) {
|
|
9
|
+
function stripAndDowncaseText(text) {
|
|
10
|
+
return text.toLowerCase().replace(/[.,/#!$%^&*;:{}=\-_`~()]/g, "").replace(/\s+/g, " ").trim();
|
|
11
|
+
}
|
|
12
|
+
_chunk5BKT4CS5js.__name.call(void 0, stripAndDowncaseText, "stripAndDowncaseText");
|
|
13
|
+
var bannedLinkText = [
|
|
14
|
+
"read more",
|
|
15
|
+
"learn more",
|
|
16
|
+
"more",
|
|
17
|
+
"here",
|
|
18
|
+
"click here",
|
|
19
|
+
"link"
|
|
20
|
+
];
|
|
21
|
+
module.exports = {
|
|
22
|
+
names: [
|
|
23
|
+
"SSW02",
|
|
24
|
+
"no-generic-link-text"
|
|
25
|
+
],
|
|
26
|
+
description: "Avoid using generic link text like `Learn more` or `Click here`",
|
|
27
|
+
information: new URL("https://github.com/github/markdownlint-github/blob/main/docs/rules/GH002-no-generic-link-text.md"),
|
|
28
|
+
tags: [
|
|
29
|
+
"accessibility",
|
|
30
|
+
"links"
|
|
31
|
+
],
|
|
32
|
+
function: /* @__PURE__ */ _chunk5BKT4CS5js.__name.call(void 0, function SS002(params, onError) {
|
|
33
|
+
let bannedLinkTexts = bannedLinkText.concat(params.config.additional_banned_texts || []);
|
|
34
|
+
const exceptions = params.config.exceptions || [];
|
|
35
|
+
if (exceptions.length > 0) {
|
|
36
|
+
bannedLinkTexts = bannedLinkTexts.filter((text) => !exceptions.includes(text));
|
|
37
|
+
}
|
|
38
|
+
const inlineTokens = params.tokens.filter((t) => t.type === "inline");
|
|
39
|
+
for (const token of inlineTokens) {
|
|
40
|
+
const { children } = token;
|
|
41
|
+
let inLink = false;
|
|
42
|
+
let linkText = "";
|
|
43
|
+
for (const child of children) {
|
|
44
|
+
const { content, type } = child;
|
|
45
|
+
if (type === "link_open") {
|
|
46
|
+
inLink = true;
|
|
47
|
+
linkText = "";
|
|
48
|
+
} else if (type === "link_close") {
|
|
49
|
+
inLink = false;
|
|
50
|
+
if (bannedLinkTexts.includes(stripAndDowncaseText(linkText))) {
|
|
51
|
+
onError({
|
|
52
|
+
lineNumber: child.lineNumber,
|
|
53
|
+
detail: `For link: ${linkText}`
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
} else if (inLink) {
|
|
57
|
+
linkText += content;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}, "SS002")
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
exports.require_no_generic_link_text = require_no_generic_link_text;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
require_no_default_alt_text
|
|
3
|
+
} from "./chunk-T5XN24SU.mjs";
|
|
4
|
+
import {
|
|
5
|
+
require_no_empty_alt_text
|
|
6
|
+
} from "./chunk-UP2FAX2A.mjs";
|
|
7
|
+
import {
|
|
8
|
+
require_no_generic_link_text
|
|
9
|
+
} from "./chunk-BLA57FQS.mjs";
|
|
10
|
+
import {
|
|
11
|
+
__toESM
|
|
12
|
+
} from "./chunk-A3UDIEI3.mjs";
|
|
13
|
+
|
|
14
|
+
// src/rules/index.ts
|
|
15
|
+
var SS01 = __toESM(require_no_default_alt_text());
|
|
16
|
+
var SS03 = __toESM(require_no_empty_alt_text());
|
|
17
|
+
var SS02 = __toESM(require_no_generic_link_text());
|
|
18
|
+
var rules = [
|
|
19
|
+
SS01,
|
|
20
|
+
SS02,
|
|
21
|
+
SS03
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
rules
|
|
26
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunk5BKT4CS5js = require('./chunk-5BKT4CS5.js');
|
|
5
|
+
|
|
6
|
+
// src/rules/no-default-alt-text.ts
|
|
7
|
+
var require_no_default_alt_text = _chunk5BKT4CS5js.__commonJS.call(void 0, {
|
|
8
|
+
"src/rules/no-default-alt-text.ts"(exports, module) {
|
|
9
|
+
var defaultScreenshotRegex = `(?:screen|clean) ?(?:shot|cast) \\d{4}-\\d{2}-\\d{2}[^'"\\]]*`;
|
|
10
|
+
var imageRegex = "image";
|
|
11
|
+
var combinedRegex = `(${[
|
|
12
|
+
defaultScreenshotRegex,
|
|
13
|
+
imageRegex
|
|
14
|
+
].join("|")})`;
|
|
15
|
+
var markdownAltRegex = new RegExp(`!\\[${combinedRegex}\\]\\(.*\\)`, "gid");
|
|
16
|
+
var htmlAltRegex = new RegExp(`alt=["']${combinedRegex}["']`, "gid");
|
|
17
|
+
module.exports = {
|
|
18
|
+
names: [
|
|
19
|
+
"SSW01",
|
|
20
|
+
"no-default-alt-text"
|
|
21
|
+
],
|
|
22
|
+
description: "Images should have meaningful alternative text (alt text)",
|
|
23
|
+
information: new URL("https://github.com/github/markdownlint-github/blob/main/docs/rules/GH001-no-default-alt-text.md"),
|
|
24
|
+
tags: [
|
|
25
|
+
"accessibility",
|
|
26
|
+
"images"
|
|
27
|
+
],
|
|
28
|
+
function: /* @__PURE__ */ _chunk5BKT4CS5js.__name.call(void 0, function SS001(params, onError) {
|
|
29
|
+
const htmlTagsWithImages = params.parsers.markdownit.tokens.filter((token) => {
|
|
30
|
+
return token.type === "html_block" && token.content.includes("<img") || token.type === "inline" && token.content.includes("<img") && token.children.some((child) => child.type === "html_inline");
|
|
31
|
+
});
|
|
32
|
+
const inlineImages = params.parsers.markdownit.tokens.filter((token) => token.type === "inline" && token.children.some((child) => child.type === "image"));
|
|
33
|
+
for (const token of [
|
|
34
|
+
...htmlTagsWithImages,
|
|
35
|
+
...inlineImages
|
|
36
|
+
]) {
|
|
37
|
+
const lineRange = token.map;
|
|
38
|
+
const lineNumber = token.lineNumber;
|
|
39
|
+
const lines = params.lines.slice(lineRange[0], lineRange[1]);
|
|
40
|
+
for (let i = 0; i < lines.length; i++) {
|
|
41
|
+
const line = lines[i];
|
|
42
|
+
let matches;
|
|
43
|
+
if (token.type === "inline") {
|
|
44
|
+
if (token.children.some((child) => child.type === "html_inline")) {
|
|
45
|
+
matches = line.matchAll(htmlAltRegex);
|
|
46
|
+
} else {
|
|
47
|
+
matches = line.matchAll(markdownAltRegex);
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
matches = line.matchAll(htmlAltRegex);
|
|
51
|
+
}
|
|
52
|
+
for (const match of matches) {
|
|
53
|
+
const altText = match[1];
|
|
54
|
+
const [startIndex] = match.indices[1];
|
|
55
|
+
onError({
|
|
56
|
+
lineNumber: lineNumber + i,
|
|
57
|
+
range: [
|
|
58
|
+
startIndex + 1,
|
|
59
|
+
altText.length
|
|
60
|
+
],
|
|
61
|
+
detail: `Flagged alt: ${altText}`
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}, "SS001")
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
exports.require_no_default_alt_text = require_no_default_alt_text;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__commonJS,
|
|
3
|
+
__name
|
|
4
|
+
} from "./chunk-A3UDIEI3.mjs";
|
|
5
|
+
|
|
6
|
+
// src/rules/no-default-alt-text.ts
|
|
7
|
+
var require_no_default_alt_text = __commonJS({
|
|
8
|
+
"src/rules/no-default-alt-text.ts"(exports, module) {
|
|
9
|
+
var defaultScreenshotRegex = `(?:screen|clean) ?(?:shot|cast) \\d{4}-\\d{2}-\\d{2}[^'"\\]]*`;
|
|
10
|
+
var imageRegex = "image";
|
|
11
|
+
var combinedRegex = `(${[
|
|
12
|
+
defaultScreenshotRegex,
|
|
13
|
+
imageRegex
|
|
14
|
+
].join("|")})`;
|
|
15
|
+
var markdownAltRegex = new RegExp(`!\\[${combinedRegex}\\]\\(.*\\)`, "gid");
|
|
16
|
+
var htmlAltRegex = new RegExp(`alt=["']${combinedRegex}["']`, "gid");
|
|
17
|
+
module.exports = {
|
|
18
|
+
names: [
|
|
19
|
+
"SSW01",
|
|
20
|
+
"no-default-alt-text"
|
|
21
|
+
],
|
|
22
|
+
description: "Images should have meaningful alternative text (alt text)",
|
|
23
|
+
information: new URL("https://github.com/github/markdownlint-github/blob/main/docs/rules/GH001-no-default-alt-text.md"),
|
|
24
|
+
tags: [
|
|
25
|
+
"accessibility",
|
|
26
|
+
"images"
|
|
27
|
+
],
|
|
28
|
+
function: /* @__PURE__ */ __name(function SS001(params, onError) {
|
|
29
|
+
const htmlTagsWithImages = params.parsers.markdownit.tokens.filter((token) => {
|
|
30
|
+
return token.type === "html_block" && token.content.includes("<img") || token.type === "inline" && token.content.includes("<img") && token.children.some((child) => child.type === "html_inline");
|
|
31
|
+
});
|
|
32
|
+
const inlineImages = params.parsers.markdownit.tokens.filter((token) => token.type === "inline" && token.children.some((child) => child.type === "image"));
|
|
33
|
+
for (const token of [
|
|
34
|
+
...htmlTagsWithImages,
|
|
35
|
+
...inlineImages
|
|
36
|
+
]) {
|
|
37
|
+
const lineRange = token.map;
|
|
38
|
+
const lineNumber = token.lineNumber;
|
|
39
|
+
const lines = params.lines.slice(lineRange[0], lineRange[1]);
|
|
40
|
+
for (let i = 0; i < lines.length; i++) {
|
|
41
|
+
const line = lines[i];
|
|
42
|
+
let matches;
|
|
43
|
+
if (token.type === "inline") {
|
|
44
|
+
if (token.children.some((child) => child.type === "html_inline")) {
|
|
45
|
+
matches = line.matchAll(htmlAltRegex);
|
|
46
|
+
} else {
|
|
47
|
+
matches = line.matchAll(markdownAltRegex);
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
matches = line.matchAll(htmlAltRegex);
|
|
51
|
+
}
|
|
52
|
+
for (const match of matches) {
|
|
53
|
+
const altText = match[1];
|
|
54
|
+
const [startIndex] = match.indices[1];
|
|
55
|
+
onError({
|
|
56
|
+
lineNumber: lineNumber + i,
|
|
57
|
+
range: [
|
|
58
|
+
startIndex + 1,
|
|
59
|
+
altText.length
|
|
60
|
+
],
|
|
61
|
+
detail: `Flagged alt: ${altText}`
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}, "SS001")
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export {
|
|
72
|
+
require_no_default_alt_text
|
|
73
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__commonJS,
|
|
3
|
+
__name
|
|
4
|
+
} from "./chunk-A3UDIEI3.mjs";
|
|
5
|
+
|
|
6
|
+
// src/rules/no-empty-alt-text.ts
|
|
7
|
+
var require_no_empty_alt_text = __commonJS({
|
|
8
|
+
"src/rules/no-empty-alt-text.ts"(exports, module) {
|
|
9
|
+
module.exports = {
|
|
10
|
+
names: [
|
|
11
|
+
"SSW03",
|
|
12
|
+
"no-empty-alt-text"
|
|
13
|
+
],
|
|
14
|
+
description: "Please provide an alternative text for the image.",
|
|
15
|
+
information: new URL("https://github.com/github/markdownlint-github/blob/main/docs/rules/GH003-no-empty-alt-text.md"),
|
|
16
|
+
tags: [
|
|
17
|
+
"accessibility",
|
|
18
|
+
"images"
|
|
19
|
+
],
|
|
20
|
+
function: /* @__PURE__ */ __name(function SS003(params, onError) {
|
|
21
|
+
const htmlTagsWithImages = params.parsers.markdownit.tokens.filter((token) => {
|
|
22
|
+
return token.type === "html_block" && token.content.includes("<img") || token.type === "inline" && token.content.includes("<img") && token.children.some((child) => child.type === "html_inline");
|
|
23
|
+
});
|
|
24
|
+
const ImageRegex = new RegExp(/<img(.*?)>/, "gid");
|
|
25
|
+
const htmlEmptyAltRegex = new RegExp(/alt=['"]['"]/, "gid");
|
|
26
|
+
for (const token of htmlTagsWithImages) {
|
|
27
|
+
const lineRange = token.map;
|
|
28
|
+
const lineNumber = token.lineNumber;
|
|
29
|
+
const lines = params.lines.slice(lineRange[0], lineRange[1]);
|
|
30
|
+
for (const [i, line] of lines.entries()) {
|
|
31
|
+
const imageTags = line.matchAll(ImageRegex);
|
|
32
|
+
for (const imageTag of imageTags) {
|
|
33
|
+
const imageTagIndex = imageTag.indices[0][0];
|
|
34
|
+
const emptyAltMatches = [
|
|
35
|
+
...imageTag[0].matchAll(htmlEmptyAltRegex)
|
|
36
|
+
][0];
|
|
37
|
+
if (emptyAltMatches) {
|
|
38
|
+
const matchingContent = emptyAltMatches[0];
|
|
39
|
+
const startIndex = emptyAltMatches.indices[0][0];
|
|
40
|
+
onError({
|
|
41
|
+
lineNumber: lineNumber + i,
|
|
42
|
+
range: [
|
|
43
|
+
imageTagIndex + startIndex + 1,
|
|
44
|
+
matchingContent.length
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}, "SS003")
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export {
|
|
57
|
+
require_no_empty_alt_text
|
|
58
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunk5BKT4CS5js = require('./chunk-5BKT4CS5.js');
|
|
5
|
+
|
|
6
|
+
// src/rules/no-empty-alt-text.ts
|
|
7
|
+
var require_no_empty_alt_text = _chunk5BKT4CS5js.__commonJS.call(void 0, {
|
|
8
|
+
"src/rules/no-empty-alt-text.ts"(exports, module) {
|
|
9
|
+
module.exports = {
|
|
10
|
+
names: [
|
|
11
|
+
"SSW03",
|
|
12
|
+
"no-empty-alt-text"
|
|
13
|
+
],
|
|
14
|
+
description: "Please provide an alternative text for the image.",
|
|
15
|
+
information: new URL("https://github.com/github/markdownlint-github/blob/main/docs/rules/GH003-no-empty-alt-text.md"),
|
|
16
|
+
tags: [
|
|
17
|
+
"accessibility",
|
|
18
|
+
"images"
|
|
19
|
+
],
|
|
20
|
+
function: /* @__PURE__ */ _chunk5BKT4CS5js.__name.call(void 0, function SS003(params, onError) {
|
|
21
|
+
const htmlTagsWithImages = params.parsers.markdownit.tokens.filter((token) => {
|
|
22
|
+
return token.type === "html_block" && token.content.includes("<img") || token.type === "inline" && token.content.includes("<img") && token.children.some((child) => child.type === "html_inline");
|
|
23
|
+
});
|
|
24
|
+
const ImageRegex = new RegExp(/<img(.*?)>/, "gid");
|
|
25
|
+
const htmlEmptyAltRegex = new RegExp(/alt=['"]['"]/, "gid");
|
|
26
|
+
for (const token of htmlTagsWithImages) {
|
|
27
|
+
const lineRange = token.map;
|
|
28
|
+
const lineNumber = token.lineNumber;
|
|
29
|
+
const lines = params.lines.slice(lineRange[0], lineRange[1]);
|
|
30
|
+
for (const [i, line] of lines.entries()) {
|
|
31
|
+
const imageTags = line.matchAll(ImageRegex);
|
|
32
|
+
for (const imageTag of imageTags) {
|
|
33
|
+
const imageTagIndex = imageTag.indices[0][0];
|
|
34
|
+
const emptyAltMatches = [
|
|
35
|
+
...imageTag[0].matchAll(htmlEmptyAltRegex)
|
|
36
|
+
][0];
|
|
37
|
+
if (emptyAltMatches) {
|
|
38
|
+
const matchingContent = emptyAltMatches[0];
|
|
39
|
+
const startIndex = emptyAltMatches.indices[0][0];
|
|
40
|
+
onError({
|
|
41
|
+
lineNumber: lineNumber + i,
|
|
42
|
+
range: [
|
|
43
|
+
imageTagIndex + startIndex + 1,
|
|
44
|
+
matchingContent.length
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}, "SS003")
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
exports.require_no_empty_alt_text = require_no_empty_alt_text;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkT2GN3E2Qjs = require('./chunk-T2GN3E2Q.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkZD5PYAVSjs = require('./chunk-ZD5PYAVS.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkCSEVGJXWjs = require('./chunk-CSEVGJXW.js');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunk5BKT4CS5js = require('./chunk-5BKT4CS5.js');
|
|
13
|
+
|
|
14
|
+
// src/rules/index.ts
|
|
15
|
+
var SS01 = _chunk5BKT4CS5js.__toESM.call(void 0, _chunkT2GN3E2Qjs.require_no_default_alt_text.call(void 0, ));
|
|
16
|
+
var SS03 = _chunk5BKT4CS5js.__toESM.call(void 0, _chunkZD5PYAVSjs.require_no_empty_alt_text.call(void 0, ));
|
|
17
|
+
var SS02 = _chunk5BKT4CS5js.__toESM.call(void 0, _chunkCSEVGJXWjs.require_no_generic_link_text.call(void 0, ));
|
|
18
|
+
var rules = [
|
|
19
|
+
SS01,
|
|
20
|
+
SS02,
|
|
21
|
+
SS03
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
exports.rules = rules;
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { S as SS01 } from './rules/no-default-alt-text.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The markdownlint library used by Storm Software for building TypeScript applications.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* An opinionated collection of markdownlint rules used by Storm Software.
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
declare const init: (defaultConfig: any) => any;
|
|
12
|
+
declare const rules: typeof SS01[];
|
|
13
|
+
declare const config: {
|
|
14
|
+
$schema: string;
|
|
15
|
+
"header-increment": boolean;
|
|
16
|
+
"first-header-h1": boolean;
|
|
17
|
+
"heading-style": {
|
|
18
|
+
style: string;
|
|
19
|
+
};
|
|
20
|
+
"ul-style": {
|
|
21
|
+
style: string;
|
|
22
|
+
};
|
|
23
|
+
"list-indent": boolean;
|
|
24
|
+
"ul-start-left": boolean;
|
|
25
|
+
"ul-indent": {
|
|
26
|
+
indent: number;
|
|
27
|
+
start_indented: boolean;
|
|
28
|
+
};
|
|
29
|
+
"no-trailing-spaces": {
|
|
30
|
+
br_spaces: number;
|
|
31
|
+
list_item_empty_lines: boolean;
|
|
32
|
+
};
|
|
33
|
+
"no-hard-tabs": {
|
|
34
|
+
code_blocks: boolean;
|
|
35
|
+
};
|
|
36
|
+
"no-reversed-links": boolean;
|
|
37
|
+
"no-multiple-blanks": {
|
|
38
|
+
maximum: number;
|
|
39
|
+
};
|
|
40
|
+
"line-length": {
|
|
41
|
+
tables: boolean;
|
|
42
|
+
code_blocks: boolean;
|
|
43
|
+
headings: boolean;
|
|
44
|
+
line_length: number;
|
|
45
|
+
heading_line_length: number;
|
|
46
|
+
code_block_line_length: number;
|
|
47
|
+
};
|
|
48
|
+
"commands-show-output": boolean;
|
|
49
|
+
"no-missing-space-atx": boolean;
|
|
50
|
+
"no-multiple-space-atx": boolean;
|
|
51
|
+
"no-missing-space-closed-atx": boolean;
|
|
52
|
+
"no-multiple-space-closed-atx": boolean;
|
|
53
|
+
"blanks-around-headers": boolean;
|
|
54
|
+
"header-start-left": boolean;
|
|
55
|
+
"no-duplicate-heading": boolean;
|
|
56
|
+
"single-h1": boolean;
|
|
57
|
+
"no-trailing-punctuation": {
|
|
58
|
+
punctuation: string;
|
|
59
|
+
};
|
|
60
|
+
"no-multiple-space-blockquote": boolean;
|
|
61
|
+
"no-blanks-blockquote": boolean;
|
|
62
|
+
"ol-prefix": {
|
|
63
|
+
style: string;
|
|
64
|
+
};
|
|
65
|
+
"list-marker-space": {
|
|
66
|
+
ul_single: number;
|
|
67
|
+
ol_single: number;
|
|
68
|
+
ul_multi: number;
|
|
69
|
+
ol_multi: number;
|
|
70
|
+
};
|
|
71
|
+
"no-empty-code-blocks": boolean;
|
|
72
|
+
"no-empty-lists": boolean;
|
|
73
|
+
"no-inline-html": boolean;
|
|
74
|
+
"no-bare-urls": boolean;
|
|
75
|
+
"hr-style": {
|
|
76
|
+
style: string;
|
|
77
|
+
};
|
|
78
|
+
"no-emphasis-as-header": boolean;
|
|
79
|
+
"no-space-in-emphasis": boolean;
|
|
80
|
+
"no-space-in-code": boolean;
|
|
81
|
+
"no-space-in-links": boolean;
|
|
82
|
+
"fenced-code-language": boolean;
|
|
83
|
+
"first-line-h1": boolean;
|
|
84
|
+
"no-empty-links": boolean;
|
|
85
|
+
"required-headers": boolean;
|
|
86
|
+
"proper-names": boolean;
|
|
87
|
+
"no-alt-text": boolean;
|
|
88
|
+
"code-block-style": {
|
|
89
|
+
style: string;
|
|
90
|
+
};
|
|
91
|
+
"single-trailing-newline": boolean;
|
|
92
|
+
"code-fence-style": {
|
|
93
|
+
style: string;
|
|
94
|
+
};
|
|
95
|
+
"emphasis-style": {
|
|
96
|
+
style: string;
|
|
97
|
+
};
|
|
98
|
+
"strong-style": {
|
|
99
|
+
style: string;
|
|
100
|
+
};
|
|
101
|
+
"link-fragments": boolean;
|
|
102
|
+
"reference-links-images": {
|
|
103
|
+
shortcut_syntax: boolean;
|
|
104
|
+
};
|
|
105
|
+
"link-image-reference-definitions": {
|
|
106
|
+
ignored_definitions: string[];
|
|
107
|
+
};
|
|
108
|
+
"link-image-style": {
|
|
109
|
+
autolink: boolean;
|
|
110
|
+
collapsed: boolean;
|
|
111
|
+
full: boolean;
|
|
112
|
+
inline: boolean;
|
|
113
|
+
shortcut: boolean;
|
|
114
|
+
url_inline: boolean;
|
|
115
|
+
};
|
|
116
|
+
"table-pipe-style": {
|
|
117
|
+
style: string;
|
|
118
|
+
};
|
|
119
|
+
"table-column-count": boolean;
|
|
120
|
+
"blanks-around-tables": boolean;
|
|
121
|
+
"spaces-around-links": {
|
|
122
|
+
both: boolean;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export { config, config as default, init, rules };
|