@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/.markdownlint.json
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"comment": "Be explicit by listing every available rule. https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md",
|
|
3
|
-
"comment": "Note that there will be numeric gaps, not every MD number is implemented in markdownlint.",
|
|
4
|
-
|
|
5
|
-
"comment": "MD001: Header levels should only increment by one level at a time.",
|
|
6
|
-
"header-increment": true,
|
|
7
|
-
|
|
8
|
-
"comment": "MD002: First header should be a top level header.",
|
|
9
|
-
"first-header-h1": true,
|
|
10
|
-
|
|
11
|
-
"comment": "MD003: Header style: start with hashes.",
|
|
12
|
-
"header-style": {
|
|
13
|
-
"style": "atx"
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
"comment": "MD004: Unordered list style",
|
|
17
|
-
"ul-style": {
|
|
18
|
-
"style": "dash"
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
"comment": "MD005: Consistent indentation for list items at the same level.",
|
|
22
|
-
"list-indent": true,
|
|
23
|
-
|
|
24
|
-
"comment": "MD006: Consider starting bulleted lists at the beginning of the line.",
|
|
25
|
-
"ul-start-left": false,
|
|
26
|
-
|
|
27
|
-
"comment": "MD007: Unordered list indentation: 2 spaces.",
|
|
28
|
-
"ul-indent": {
|
|
29
|
-
"indent": 2,
|
|
30
|
-
"start_indented": true
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
"comment": "MD009: Disallow trailing spaces!",
|
|
34
|
-
"no-trailing-spaces": {
|
|
35
|
-
"br_spaces": 0,
|
|
36
|
-
"comment": "Empty lines inside list items should not be indented.",
|
|
37
|
-
"list_item_empty_lines": false
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
"comment": "MD010: No hard tabs, not even in code blocks.",
|
|
41
|
-
"no-hard-tabs": {
|
|
42
|
-
"code_blocks": true
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
"comment": "MD011: Prevent reversed link syntax",
|
|
46
|
-
"no-reversed-links": true,
|
|
47
|
-
|
|
48
|
-
"comment": "MD012: Disallow multiple consecutive blank lines.",
|
|
49
|
-
"no-multiple-blanks": {
|
|
50
|
-
"maximum": 1
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
"comment": "MD013: Line length",
|
|
54
|
-
"line-length": false,
|
|
55
|
-
|
|
56
|
-
"comment": "MD014: Disallow use of dollar signs($) before commands without showing output.",
|
|
57
|
-
"commands-show-output": true,
|
|
58
|
-
|
|
59
|
-
"comment": "MD018: Disallow space after hash on atx style header.",
|
|
60
|
-
"no-missing-space-atx": true,
|
|
61
|
-
|
|
62
|
-
"comment": "MD019: Disallow multiple spaces after hash on atx style header.",
|
|
63
|
-
"no-multiple-space-atx": true,
|
|
64
|
-
|
|
65
|
-
"comment": "MD020: No space should be inside hashes on closed atx style header.",
|
|
66
|
-
"no-missing-space-closed-atx": true,
|
|
67
|
-
|
|
68
|
-
"comment": "MD021: Disallow multiple spaces inside hashes on closed atx style header.",
|
|
69
|
-
"no-multiple-space-closed-atx": true,
|
|
70
|
-
|
|
71
|
-
"comment": "MD022: Headers should be surrounded by blank lines.",
|
|
72
|
-
"comment": "Some headers have preceding HTML anchors. Unfortunate that we have to disable this, as it otherwise catches a real problem that trips up some Markdown renderers",
|
|
73
|
-
"blanks-around-headers": false,
|
|
74
|
-
|
|
75
|
-
"comment": "MD023: Headers must start at the beginning of the line.",
|
|
76
|
-
"header-start-left": true,
|
|
77
|
-
|
|
78
|
-
"comment": "MD024: Disallow multiple headers with the same content.",
|
|
79
|
-
"no-duplicate-header": true,
|
|
80
|
-
|
|
81
|
-
"comment": "MD025: Disallow multiple top level headers in the same document.",
|
|
82
|
-
"comment": "Gotta have a matching closing brace at the end.",
|
|
83
|
-
"single-h1": false,
|
|
84
|
-
|
|
85
|
-
"comment": "MD026: Disallow trailing punctuation in header.",
|
|
86
|
-
"comment": "You must have a semicolon after the ending closing brace.",
|
|
87
|
-
"no-trailing-punctuation": {
|
|
88
|
-
"punctuation": ".,:!?"
|
|
89
|
-
},
|
|
90
|
-
"comment": "MD027: Dissalow multiple spaces after blockquote symbol",
|
|
91
|
-
"no-multiple-space-blockquote": true,
|
|
92
|
-
|
|
93
|
-
"comment": "MD028: Blank line inside blockquote",
|
|
94
|
-
"comment": "Some 'Why?' and 'Why not?' blocks are separated by a blank line",
|
|
95
|
-
"no-blanks-blockquote": false,
|
|
96
|
-
|
|
97
|
-
"comment": "MD029: Ordered list item prefix",
|
|
98
|
-
"ol-prefix": {
|
|
99
|
-
"style": "one"
|
|
100
|
-
},
|
|
101
|
-
|
|
102
|
-
"comment": "MD030: Spaces after list markers",
|
|
103
|
-
"list-marker-space": {
|
|
104
|
-
"ul_single": 1,
|
|
105
|
-
"ol_single": 1,
|
|
106
|
-
"ul_multi": 1,
|
|
107
|
-
"ol_multi": 1
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
"comment": "MD031: Fenced code blocks should be surrounded by blank lines",
|
|
111
|
-
"blanks-around-fences": true,
|
|
112
|
-
|
|
113
|
-
"comment": "MD032: Lists should be surrounded by blank lines",
|
|
114
|
-
"comment": "Some lists have preceding HTML anchors. Unfortunate that we have to disable this, as it otherwise catches a real problem that trips up some Markdown renderers",
|
|
115
|
-
"blanks-around-lists": false,
|
|
116
|
-
|
|
117
|
-
"comment": "MD033: Disallow inline HTML",
|
|
118
|
-
"comment": "HTML is needed for explicit anchors",
|
|
119
|
-
"no-inline-html": false,
|
|
120
|
-
|
|
121
|
-
"comment": "MD034: No bare URLs should be used",
|
|
122
|
-
"no-bare-urls": true,
|
|
123
|
-
|
|
124
|
-
"comment": "MD035: Horizontal rule style",
|
|
125
|
-
"hr-style": {
|
|
126
|
-
"style": "consistent"
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
"comment": "MD036: Do not use emphasis instead of a header.",
|
|
130
|
-
"no-emphasis-as-header": false,
|
|
131
|
-
|
|
132
|
-
"comment": "MD037: Disallow spaces inside emphasis markers.",
|
|
133
|
-
"no-space-in-emphasis": true,
|
|
134
|
-
|
|
135
|
-
"comment": "MD038: Disallow spaces inside code span elements.",
|
|
136
|
-
"no-space-in-code": true,
|
|
137
|
-
|
|
138
|
-
"comment": "MD039: Disallow spaces inside link text.",
|
|
139
|
-
"no-space-in-links": true,
|
|
140
|
-
|
|
141
|
-
"comment": "MD040: Fenced code blocks should have a language specified.",
|
|
142
|
-
"fenced-code-language": true,
|
|
143
|
-
|
|
144
|
-
"comment": "MD041: First line in file should be a top level header.",
|
|
145
|
-
"first-line-h1": true,
|
|
146
|
-
|
|
147
|
-
"comment": "MD042: No empty links",
|
|
148
|
-
"no-empty-links": true,
|
|
149
|
-
|
|
150
|
-
"comment": "MD043: Required header structure.",
|
|
151
|
-
"required-headers": false,
|
|
152
|
-
|
|
153
|
-
"comment": "MD044: Proper names should have the correct capitalization.",
|
|
154
|
-
"proper-names": false
|
|
155
|
-
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
## 0.12.7 (2025-01-13)
|
|
2
|
-
|
|
3
|
-
### Bug Fixes
|
|
4
|
-
|
|
5
|
-
- **unbuild:** Resolved issue with distribution package ([265f38a2](https://github.com/storm-software/storm-ops/commit/265f38a2))
|
|
6
|
-
|
|
7
|
-
## 0.12.6 (2025-01-12)
|
|
8
|
-
|
|
9
|
-
### Miscellaneous
|
|
10
|
-
|
|
11
|
-
- **monorepo:** Regenerate README markdown files ([a104880f](https://github.com/storm-software/storm-ops/commit/a104880f))
|
|
12
|
-
|
|
13
|
-
## 0.12.5 (2025-01-12)
|
|
14
|
-
|
|
15
|
-
### Bug Fixes
|
|
16
|
-
|
|
17
|
-
- **eslint:** Resolve stack overflow error on eslint configuration load ([f66752ac](https://github.com/storm-software/storm-ops/commit/f66752ac))
|
|
18
|
-
|
|
19
|
-
## 0.12.4 (2025-01-11)
|
|
20
|
-
|
|
21
|
-
### Bug Fixes
|
|
22
|
-
|
|
23
|
-
- **eslint:** Resolved issue with the bundling process ([d06b6588](https://github.com/storm-software/storm-ops/commit/d06b6588))
|
|
24
|
-
|
|
25
|
-
## 0.12.3 (2025-01-11)
|
|
26
|
-
|
|
27
|
-
### Bug Fixes
|
|
28
|
-
|
|
29
|
-
- **workspace-tools:** Resolve issue loading pnpm workspace's catalog dependencies ([1199e24f](https://github.com/storm-software/storm-ops/commit/1199e24f))
|
|
30
|
-
|
|
31
|
-
## 0.12.2 (2025-01-11)
|
|
32
|
-
|
|
33
|
-
### Miscellaneous
|
|
34
|
-
|
|
35
|
-
- **workspace-tools:** Added additional logging for pnpm dependency updates process ([400b3369](https://github.com/storm-software/storm-ops/commit/400b3369))
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
## 0.12.0 (2024-12-30)
|
|
40
|
-
|
|
41
|
-
### Features
|
|
42
|
-
|
|
43
|
-
- **storm-ops:** Completed enhancement around `catalog` and `workspace` dependency upgrades ([5dd13247](https://github.com/storm-software/storm-ops/commit/5dd13247))
|
|
44
|
-
|
|
45
|
-
### Dependency Upgrades
|
|
46
|
-
|
|
47
|
-
- **storm-ops:** Added consistent `@types/node` versions across repository ([a569536d](https://github.com/storm-software/storm-ops/commit/a569536d))
|
|
48
|
-
|
|
49
|
-
## 0.11.0 (2024-07-17)
|
|
50
|
-
|
|
51
|
-
### Features
|
|
52
|
-
|
|
53
|
-
- **git-tools:** Added README header template to include table of contents
|
|
54
|
-
([6841042e](https://github.com/storm-software/storm-ops/commit/6841042e))
|
|
55
|
-
|
|
56
|
-
## 0.10.0 (2024-07-14)
|
|
57
|
-
|
|
58
|
-
### Features
|
|
59
|
-
|
|
60
|
-
- **markdownlint:** Added markdownlint v1 json configuration
|
|
61
|
-
([9fbd4fd0](https://github.com/storm-software/storm-ops/commit/9fbd4fd0))
|
|
62
|
-
|
|
63
|
-
- **markdownlint:** Ensure markdownlint.json is included in package
|
|
64
|
-
([ddc5639b](https://github.com/storm-software/storm-ops/commit/ddc5639b))
|
|
65
|
-
|
|
66
|
-
## 0.9.0 (2024-06-22)
|
|
67
|
-
|
|
68
|
-
### Features
|
|
69
|
-
|
|
70
|
-
- **workspace-tools:** Upgrade the workspace pnpm-lock file
|
|
71
|
-
([d33c20cb](https://github.com/storm-software/storm-ops/commit/d33c20cb))
|
|
72
|
-
|
|
73
|
-
## 0.8.0 (2024-06-22)
|
|
74
|
-
|
|
75
|
-
### Features
|
|
76
|
-
|
|
77
|
-
- **storm-ops:** Updated pnpm-lock file
|
|
78
|
-
([22be1efd](https://github.com/storm-software/storm-ops/commit/22be1efd))
|
|
79
|
-
|
|
80
|
-
## 0.7.0 (2024-06-22)
|
|
81
|
-
|
|
82
|
-
### Features
|
|
83
|
-
|
|
84
|
-
- **workspace-tools:** Added `lint` and `format` tasks and improved cache input
|
|
85
|
-
management
|
|
86
|
-
([f2ade202](https://github.com/storm-software/storm-ops/commit/f2ade202))
|
|
87
|
-
|
|
88
|
-
## 0.6.0 (2024-06-21)
|
|
89
|
-
|
|
90
|
-
### Features
|
|
91
|
-
|
|
92
|
-
- **eslint-plugin:** Resolve issues with eslint module types
|
|
93
|
-
([ca513974](https://github.com/storm-software/storm-ops/commit/ca513974))
|
|
94
|
-
|
|
95
|
-
## 0.5.1 (2024-06-05)
|
|
96
|
-
|
|
97
|
-
### Bug Fixes
|
|
98
|
-
|
|
99
|
-
- **markdownlint:** Resolve issue with bad rules export
|
|
100
|
-
([7e6e5375](https://github.com/storm-software/storm-ops/commit/7e6e5375))
|
|
101
|
-
|
|
102
|
-
## 0.5.0 (2024-06-05)
|
|
103
|
-
|
|
104
|
-
### Features
|
|
105
|
-
|
|
106
|
-
- **eslint-plugin:** Added the `apply` helper function
|
|
107
|
-
([ab919d5e](https://github.com/storm-software/storm-ops/commit/ab919d5e))
|
|
108
|
-
|
|
109
|
-
## 0.4.0 (2024-06-05)
|
|
110
|
-
|
|
111
|
-
### Features
|
|
112
|
-
|
|
113
|
-
- **eslint-plugin:** Added the `eslint` and `prittier` base packages
|
|
114
|
-
([b2d63d0f](https://github.com/storm-software/storm-ops/commit/b2d63d0f))
|
|
115
|
-
|
|
116
|
-
- **workspace-tools:** Update `preset` generator with Storm `eslint-plugin` and
|
|
117
|
-
`prettier` config
|
|
118
|
-
([24ae7683](https://github.com/storm-software/storm-ops/commit/24ae7683))
|
|
119
|
-
|
|
120
|
-
### Bug Fixes
|
|
121
|
-
|
|
122
|
-
- **eslint:** Resolve issue with missing dependencies
|
|
123
|
-
([b0f43454](https://github.com/storm-software/storm-ops/commit/b0f43454))
|
|
124
|
-
|
|
125
|
-
## 0.3.0 (2024-06-03)
|
|
126
|
-
|
|
127
|
-
### Features
|
|
128
|
-
|
|
129
|
-
- **storm-ops:** Upgrade Nx packages and resolve linting issues
|
|
130
|
-
([685c2bb9](https://github.com/storm-software/storm-ops/commit/685c2bb9))
|
|
131
|
-
|
|
132
|
-
### Bug Fixes
|
|
133
|
-
|
|
134
|
-
- **git-tools:** Resolved issue with import in markdown formatter
|
|
135
|
-
([5e3963de](https://github.com/storm-software/storm-ops/commit/5e3963de))
|
|
136
|
-
|
|
137
|
-
## 0.2.0 (2024-05-29)
|
|
138
|
-
|
|
139
|
-
### Features
|
|
140
|
-
|
|
141
|
-
- **cloudflare-tools:** Update worker generator to add hono depenendency
|
|
142
|
-
([946a9e59](https://github.com/storm-software/storm-ops/commit/946a9e59))
|
|
143
|
-
|
|
144
|
-
## 0.1.2 (2024-05-27)
|
|
145
|
-
|
|
146
|
-
### Bug Fixes
|
|
147
|
-
|
|
148
|
-
- **deps:** pin dependencies
|
|
149
|
-
([604f8bbb](https://github.com/storm-software/storm-ops/commit/604f8bbb))
|
|
150
|
-
|
|
151
|
-
## 0.1.1 (2024-05-06)
|
|
152
|
-
|
|
153
|
-
### Bug Fixes
|
|
154
|
-
|
|
155
|
-
- **markdownlint:** Resolved issue with bad config in lint file
|
|
156
|
-
([95b3aba7](https://github.com/storm-software/storm-ops/commit/95b3aba7))
|
|
157
|
-
|
|
158
|
-
## 0.1.0 (2024-05-06)
|
|
159
|
-
|
|
160
|
-
### Features
|
|
161
|
-
|
|
162
|
-
- **markdownlint:** Added the `markdownlint` package for shared configurations
|
|
163
|
-
([abd6fa38](https://github.com/storm-software/storm-ops/commit/abd6fa38))
|
package/index.js
DELETED
|
@@ -1,252 +0,0 @@
|
|
|
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 __commonJS = (cb, mod) => function __require() {
|
|
8
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
-
};
|
|
10
|
-
var __export = (target, all) => {
|
|
11
|
-
for (var name in all)
|
|
12
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
-
};
|
|
14
|
-
var __copyProps = (to, from, except, desc) => {
|
|
15
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
-
for (let key of __getOwnPropNames(from))
|
|
17
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
-
mod
|
|
29
|
-
));
|
|
30
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
|
-
|
|
32
|
-
// packages/markdownlint/src/rules/no-default-alt-text.ts
|
|
33
|
-
var require_no_default_alt_text = __commonJS({
|
|
34
|
-
"packages/markdownlint/src/rules/no-default-alt-text.ts"(exports2, module2) {
|
|
35
|
-
var defaultScreenshotRegex = `(?:screen|clean) ?(?:shot|cast) \\d{4}-\\d{2}-\\d{2}[^'"\\]]*`;
|
|
36
|
-
var imageRegex = "image";
|
|
37
|
-
var combinedRegex = `(${[defaultScreenshotRegex, imageRegex].join("|")})`;
|
|
38
|
-
var markdownAltRegex = new RegExp(`!\\[${combinedRegex}\\]\\(.*\\)`, "gid");
|
|
39
|
-
var htmlAltRegex = new RegExp(`alt=["']${combinedRegex}["']`, "gid");
|
|
40
|
-
module2.exports = {
|
|
41
|
-
names: ["SS001", "no-default-alt-text"],
|
|
42
|
-
description: "Images should have meaningful alternative text (alt text)",
|
|
43
|
-
information: new URL(
|
|
44
|
-
"https://github.com/github/markdownlint-github/blob/main/docs/rules/GH001-no-default-alt-text.md"
|
|
45
|
-
),
|
|
46
|
-
tags: ["accessibility", "images"],
|
|
47
|
-
function: function SS001(params, onError) {
|
|
48
|
-
const htmlTagsWithImages = params.parsers.markdownit.tokens.filter(
|
|
49
|
-
(token) => {
|
|
50
|
-
return token.type === "html_block" && token.content.includes("<img") || token.type === "inline" && token.content.includes("<img") && token.children.some((child) => child.type === "html_inline");
|
|
51
|
-
}
|
|
52
|
-
);
|
|
53
|
-
const inlineImages = params.parsers.markdownit.tokens.filter(
|
|
54
|
-
(token) => token.type === "inline" && token.children.some((child) => child.type === "image")
|
|
55
|
-
);
|
|
56
|
-
for (const token of [...htmlTagsWithImages, ...inlineImages]) {
|
|
57
|
-
const lineRange = token.map;
|
|
58
|
-
const lineNumber = token.lineNumber;
|
|
59
|
-
const lines = params.lines.slice(lineRange[0], lineRange[1]);
|
|
60
|
-
for (let i = 0; i < lines.length; i++) {
|
|
61
|
-
const line = lines[i];
|
|
62
|
-
let matches;
|
|
63
|
-
if (token.type === "inline") {
|
|
64
|
-
if (token.children.some((child) => child.type === "html_inline")) {
|
|
65
|
-
matches = line.matchAll(htmlAltRegex);
|
|
66
|
-
} else {
|
|
67
|
-
matches = line.matchAll(markdownAltRegex);
|
|
68
|
-
}
|
|
69
|
-
} else {
|
|
70
|
-
matches = line.matchAll(htmlAltRegex);
|
|
71
|
-
}
|
|
72
|
-
for (const match of matches) {
|
|
73
|
-
const altText = match[1];
|
|
74
|
-
const [startIndex] = match.indices[1];
|
|
75
|
-
onError({
|
|
76
|
-
lineNumber: lineNumber + i,
|
|
77
|
-
range: [startIndex + 1, altText.length],
|
|
78
|
-
detail: `Flagged alt: ${altText}`
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
// packages/markdownlint/src/rules/no-empty-alt-text.ts
|
|
89
|
-
var require_no_empty_alt_text = __commonJS({
|
|
90
|
-
"packages/markdownlint/src/rules/no-empty-alt-text.ts"(exports2, module2) {
|
|
91
|
-
module2.exports = {
|
|
92
|
-
names: ["SS003", "no-empty-alt-text"],
|
|
93
|
-
description: "Please provide an alternative text for the image.",
|
|
94
|
-
information: new URL(
|
|
95
|
-
"https://github.com/github/markdownlint-github/blob/main/docs/rules/GH003-no-empty-alt-text.md"
|
|
96
|
-
),
|
|
97
|
-
tags: ["accessibility", "images"],
|
|
98
|
-
function: function SS003(params, onError) {
|
|
99
|
-
const htmlTagsWithImages = params.parsers.markdownit.tokens.filter(
|
|
100
|
-
(token) => {
|
|
101
|
-
return token.type === "html_block" && token.content.includes("<img") || token.type === "inline" && token.content.includes("<img") && token.children.some((child) => child.type === "html_inline");
|
|
102
|
-
}
|
|
103
|
-
);
|
|
104
|
-
const ImageRegex = new RegExp(/<img(.*?)>/, "gid");
|
|
105
|
-
const htmlEmptyAltRegex = new RegExp(/alt=['"]['"]/, "gid");
|
|
106
|
-
for (const token of htmlTagsWithImages) {
|
|
107
|
-
const lineRange = token.map;
|
|
108
|
-
const lineNumber = token.lineNumber;
|
|
109
|
-
const lines = params.lines.slice(lineRange[0], lineRange[1]);
|
|
110
|
-
for (const [i, line] of lines.entries()) {
|
|
111
|
-
const imageTags = line.matchAll(ImageRegex);
|
|
112
|
-
for (const imageTag of imageTags) {
|
|
113
|
-
const imageTagIndex = imageTag.indices[0][0];
|
|
114
|
-
const emptyAltMatches = [
|
|
115
|
-
...imageTag[0].matchAll(htmlEmptyAltRegex)
|
|
116
|
-
][0];
|
|
117
|
-
if (emptyAltMatches) {
|
|
118
|
-
const matchingContent = emptyAltMatches[0];
|
|
119
|
-
const startIndex = emptyAltMatches.indices[0][0];
|
|
120
|
-
onError({
|
|
121
|
-
lineNumber: lineNumber + i,
|
|
122
|
-
range: [imageTagIndex + startIndex + 1, matchingContent.length]
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
// packages/markdownlint/src/rules/no-generic-link-text.ts
|
|
134
|
-
var require_no_generic_link_text = __commonJS({
|
|
135
|
-
"packages/markdownlint/src/rules/no-generic-link-text.ts"(exports2, module2) {
|
|
136
|
-
function stripAndDowncaseText(text) {
|
|
137
|
-
return text.toLowerCase().replace(/[.,/#!$%^&*;:{}=\-_`~()]/g, "").replace(/\s+/g, " ").trim();
|
|
138
|
-
}
|
|
139
|
-
var bannedLinkText = [
|
|
140
|
-
"read more",
|
|
141
|
-
"learn more",
|
|
142
|
-
"more",
|
|
143
|
-
"here",
|
|
144
|
-
"click here",
|
|
145
|
-
"link"
|
|
146
|
-
];
|
|
147
|
-
module2.exports = {
|
|
148
|
-
names: ["SS002", "no-generic-link-text"],
|
|
149
|
-
description: "Avoid using generic link text like `Learn more` or `Click here`",
|
|
150
|
-
information: new URL(
|
|
151
|
-
"https://github.com/github/markdownlint-github/blob/main/docs/rules/GH002-no-generic-link-text.md"
|
|
152
|
-
),
|
|
153
|
-
tags: ["accessibility", "links"],
|
|
154
|
-
function: function SS002(params, onError) {
|
|
155
|
-
let bannedLinkTexts = bannedLinkText.concat(
|
|
156
|
-
params.config.additional_banned_texts || []
|
|
157
|
-
);
|
|
158
|
-
const exceptions = params.config.exceptions || [];
|
|
159
|
-
if (exceptions.length > 0) {
|
|
160
|
-
bannedLinkTexts = bannedLinkTexts.filter(
|
|
161
|
-
(text) => !exceptions.includes(text)
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
const inlineTokens = params.tokens.filter((t) => t.type === "inline");
|
|
165
|
-
for (const token of inlineTokens) {
|
|
166
|
-
const { children } = token;
|
|
167
|
-
let inLink = false;
|
|
168
|
-
let linkText = "";
|
|
169
|
-
for (const child of children) {
|
|
170
|
-
const { content, type } = child;
|
|
171
|
-
if (type === "link_open") {
|
|
172
|
-
inLink = true;
|
|
173
|
-
linkText = "";
|
|
174
|
-
} else if (type === "link_close") {
|
|
175
|
-
inLink = false;
|
|
176
|
-
if (bannedLinkTexts.includes(stripAndDowncaseText(linkText))) {
|
|
177
|
-
onError({
|
|
178
|
-
lineNumber: child.lineNumber,
|
|
179
|
-
detail: `For link: ${linkText}`
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
} else if (inLink) {
|
|
183
|
-
linkText += content;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
// packages/markdownlint/src/index.ts
|
|
193
|
-
var index_exports = {};
|
|
194
|
-
__export(index_exports, {
|
|
195
|
-
default: () => index_default,
|
|
196
|
-
init: () => init
|
|
197
|
-
});
|
|
198
|
-
module.exports = __toCommonJS(index_exports);
|
|
199
|
-
var import_lodash = __toESM(require("lodash"));
|
|
200
|
-
|
|
201
|
-
// packages/markdownlint/src/rules/index.ts
|
|
202
|
-
var SS01 = __toESM(require_no_default_alt_text());
|
|
203
|
-
var SS03 = __toESM(require_no_empty_alt_text());
|
|
204
|
-
var SS02 = __toESM(require_no_generic_link_text());
|
|
205
|
-
var rules = [SS01, SS02, SS03];
|
|
206
|
-
|
|
207
|
-
// packages/markdownlint/src/style/accessibility.json
|
|
208
|
-
var accessibility_default = {
|
|
209
|
-
"no-alt-text": true,
|
|
210
|
-
"no-default-alt-text": true,
|
|
211
|
-
"no-duplicate-header": true,
|
|
212
|
-
"no-emphasis-as-header": true,
|
|
213
|
-
"no-generic-link-text": true,
|
|
214
|
-
"heading-increment": true,
|
|
215
|
-
"no-space-in-links": false,
|
|
216
|
-
"ol-prefix": "ordered",
|
|
217
|
-
"single-h1": true,
|
|
218
|
-
"ul-style": {
|
|
219
|
-
style: "asterisk"
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
// packages/markdownlint/src/style/base.json
|
|
224
|
-
var base_default = {
|
|
225
|
-
default: true,
|
|
226
|
-
"no-inline-html": false,
|
|
227
|
-
"no-bare-urls": false,
|
|
228
|
-
"no-alt-text": true,
|
|
229
|
-
"no-blanks-blockquote": false,
|
|
230
|
-
"fenced-code-language": true,
|
|
231
|
-
"heading-increment": true,
|
|
232
|
-
"single-h1": true,
|
|
233
|
-
"no-emphasis-as-header": true,
|
|
234
|
-
"first-line-heading": false
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
// packages/markdownlint/src/index.ts
|
|
238
|
-
var offByDefault = [];
|
|
239
|
-
for (const rule of rules) {
|
|
240
|
-
const ruleName = rule?.names[1];
|
|
241
|
-
if (ruleName) {
|
|
242
|
-
base_default[ruleName] = offByDefault.includes(ruleName) ? false : true;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
var init = function init2(defaultConfig) {
|
|
246
|
-
return import_lodash.default.defaultsDeep(defaultConfig, accessibility_default, base_default);
|
|
247
|
-
};
|
|
248
|
-
var index_default = [...rules];
|
|
249
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
250
|
-
0 && (module.exports = {
|
|
251
|
-
init
|
|
252
|
-
});
|