markdownlint 0.24.0 → 0.26.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.
Files changed (51) hide show
  1. package/CONTRIBUTING.md +15 -3
  2. package/LICENSE +1 -1
  3. package/README.md +138 -87
  4. package/demo/markdownlint-browser.js +2028 -1364
  5. package/doc/CustomRules.md +15 -4
  6. package/doc/Rules.md +217 -26
  7. package/helpers/LICENSE +1 -1
  8. package/helpers/helpers.js +541 -188
  9. package/helpers/package.json +4 -1
  10. package/lib/cache.js +15 -25
  11. package/lib/constants.js +7 -0
  12. package/lib/markdownlint.d.ts +27 -19
  13. package/lib/markdownlint.js +438 -344
  14. package/lib/md004.js +4 -4
  15. package/lib/md005.js +4 -4
  16. package/lib/md006.js +4 -4
  17. package/lib/md007.js +8 -6
  18. package/lib/md009.js +20 -13
  19. package/lib/md010.js +34 -16
  20. package/lib/md011.js +4 -4
  21. package/lib/md013.js +4 -5
  22. package/lib/md014.js +4 -4
  23. package/lib/md021.js +3 -1
  24. package/lib/md026.js +1 -1
  25. package/lib/md027.js +2 -2
  26. package/lib/md028.js +2 -2
  27. package/lib/md029.js +5 -4
  28. package/lib/md030.js +4 -4
  29. package/lib/md031.js +2 -2
  30. package/lib/md032.js +3 -2
  31. package/lib/md033.js +12 -9
  32. package/lib/md034.js +2 -2
  33. package/lib/md035.js +10 -5
  34. package/lib/md036.js +2 -2
  35. package/lib/md037.js +5 -3
  36. package/lib/md038.js +7 -4
  37. package/lib/md039.js +8 -5
  38. package/lib/md042.js +17 -10
  39. package/lib/md043.js +2 -3
  40. package/lib/md044.js +21 -10
  41. package/lib/md046.js +14 -13
  42. package/lib/md048.js +13 -14
  43. package/lib/md049-md050.js +73 -0
  44. package/lib/md051.js +84 -0
  45. package/lib/md052.js +35 -0
  46. package/lib/md053.js +52 -0
  47. package/lib/rules.js +8 -6
  48. package/package.json +37 -32
  49. package/schema/.markdownlint.jsonc +30 -3
  50. package/schema/.markdownlint.yaml +26 -1
  51. package/schema/markdownlint-config-schema.json +159 -683
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markdownlint-rule-helpers",
3
- "version": "0.15.0",
3
+ "version": "0.17.0",
4
4
  "description": "A collection of markdownlint helper functions for custom rules",
5
5
  "main": "helpers.js",
6
6
  "author": "David Anson (https://dlaa.me/)",
@@ -11,6 +11,9 @@
11
11
  "url": "https://github.com/DavidAnson/markdownlint.git"
12
12
  },
13
13
  "bugs": "https://github.com/DavidAnson/markdownlint/issues",
14
+ "engines": {
15
+ "node": ">=12"
16
+ },
14
17
  "keywords": [
15
18
  "markdownlint",
16
19
  "markdownlint-rule"
package/lib/cache.js CHANGED
@@ -2,32 +2,22 @@
2
2
 
3
3
  "use strict";
4
4
 
5
- let flattenedLists = null;
6
- module.exports.flattenedLists = (value) => {
7
- if (value) {
8
- flattenedLists = value;
9
- }
10
- return flattenedLists;
11
- };
12
-
13
- let inlineCodeSpanRanges = null;
14
- module.exports.inlineCodeSpanRanges = (value) => {
15
- if (value) {
16
- inlineCodeSpanRanges = value;
17
- }
18
- return inlineCodeSpanRanges;
19
- };
5
+ const map = new Map();
20
6
 
21
- let lineMetadata = null;
22
- module.exports.lineMetadata = (value) => {
23
- if (value) {
24
- lineMetadata = value;
7
+ module.exports.set = (keyValuePairs) => {
8
+ for (const [ key, value ] of Object.entries(keyValuePairs)) {
9
+ map.set(key, value);
25
10
  }
26
- return lineMetadata;
27
11
  };
12
+ module.exports.clear = () => map.clear();
28
13
 
29
- module.exports.clear = () => {
30
- flattenedLists = null;
31
- inlineCodeSpanRanges = null;
32
- lineMetadata = null;
33
- };
14
+ module.exports.codeBlockAndSpanRanges =
15
+ () => map.get("codeBlockAndSpanRanges");
16
+ module.exports.flattenedLists =
17
+ () => map.get("flattenedLists");
18
+ module.exports.htmlElementRanges =
19
+ () => map.get("htmlElementRanges");
20
+ module.exports.lineMetadata =
21
+ () => map.get("lineMetadata");
22
+ module.exports.referenceLinkImageData =
23
+ () => map.get("referenceLinkImageData");
@@ -0,0 +1,7 @@
1
+ // @ts-check
2
+
3
+ "use strict";
4
+
5
+ module.exports.deprecatedRuleNames = [ "MD002", "MD006" ];
6
+ module.exports.homepage = "https://github.com/DavidAnson/markdownlint";
7
+ module.exports.version = "0.26.0";
@@ -14,32 +14,38 @@ declare namespace markdownlint {
14
14
  * Configuration options.
15
15
  */
16
16
  type Options = {
17
- /**
18
- * Files to lint.
19
- */
20
- files?: string[] | string;
21
- /**
22
- * Strings to lint.
23
- */
24
- strings?: {
25
- [x: string]: string;
26
- };
27
17
  /**
28
18
  * Configuration object.
29
19
  */
30
20
  config?: Configuration;
21
+ /**
22
+ * Configuration parsers.
23
+ */
24
+ configParsers?: ConfigurationParser[];
31
25
  /**
32
26
  * Custom rules.
33
27
  */
34
28
  customRules?: Rule[] | Rule;
29
+ /**
30
+ * Files to lint.
31
+ */
32
+ files?: string[] | string;
35
33
  /**
36
34
  * Front matter pattern.
37
35
  */
38
36
  frontMatter?: RegExp;
37
+ /**
38
+ * File system implementation.
39
+ */
40
+ fs?: any;
39
41
  /**
40
42
  * True to catch exceptions.
41
43
  */
42
44
  handleRuleFailures?: boolean;
45
+ /**
46
+ * Additional plugins.
47
+ */
48
+ markdownItPlugins?: Plugin[];
43
49
  /**
44
50
  * True to ignore HTML directives.
45
51
  */
@@ -49,13 +55,11 @@ type Options = {
49
55
  */
50
56
  resultVersion?: number;
51
57
  /**
52
- * Additional plugins.
53
- */
54
- markdownItPlugins?: Plugin[];
55
- /**
56
- * File system implementation.
58
+ * Strings to lint.
57
59
  */
58
- fs?: any;
60
+ strings?: {
61
+ [x: string]: string;
62
+ };
59
63
  };
60
64
  /**
61
65
  * Called with the result of the lint function.
@@ -206,9 +210,9 @@ type RuleOnErrorInfo = {
206
210
  */
207
211
  lineNumber: number;
208
212
  /**
209
- * Details about the error.
213
+ * Detail about the error.
210
214
  */
211
- details?: string;
215
+ detail?: string;
212
216
  /**
213
217
  * Context for the error.
214
218
  */
@@ -263,6 +267,10 @@ type Rule = {
263
267
  * Rule tag(s).
264
268
  */
265
269
  tags: string[];
270
+ /**
271
+ * True if asynchronous.
272
+ */
273
+ asynchronous?: boolean;
266
274
  /**
267
275
  * Rule implementation.
268
276
  */
@@ -342,7 +350,7 @@ type FixInfo = {
342
350
  };
343
351
  /**
344
352
  * Configuration object for linting rules. For a detailed schema, see
345
- * {@link ../schema/markdownlint-config-schema.json}.
353
+ * {@link ../schema/markdownlint-config-schema.json}.
346
354
  */
347
355
  type Configuration = {
348
356
  [x: string]: RuleConfiguration;