markdownlint 0.25.0 → 0.26.1

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 +2 -0
  2. package/LICENSE +1 -1
  3. package/README.md +125 -83
  4. package/demo/markdownlint-browser.js +1719 -1269
  5. package/doc/Rules.md +133 -15
  6. package/helpers/LICENSE +1 -1
  7. package/helpers/helpers.js +427 -192
  8. package/helpers/package.json +6 -2
  9. package/lib/cache.js +15 -25
  10. package/lib/constants.js +1 -1
  11. package/lib/markdownlint.d.ts +21 -17
  12. package/lib/markdownlint.js +237 -146
  13. package/lib/md004.js +4 -4
  14. package/lib/md005.js +4 -4
  15. package/lib/md006.js +4 -4
  16. package/lib/md007.js +4 -4
  17. package/lib/md009.js +20 -13
  18. package/lib/md010.js +15 -2
  19. package/lib/md011.js +2 -2
  20. package/lib/md013.js +4 -5
  21. package/lib/md014.js +4 -4
  22. package/lib/md021.js +3 -1
  23. package/lib/md026.js +1 -1
  24. package/lib/md027.js +2 -2
  25. package/lib/md028.js +2 -2
  26. package/lib/md029.js +5 -4
  27. package/lib/md030.js +4 -4
  28. package/lib/md031.js +2 -2
  29. package/lib/md032.js +3 -2
  30. package/lib/md033.js +2 -3
  31. package/lib/md034.js +2 -2
  32. package/lib/md035.js +7 -2
  33. package/lib/md036.js +2 -2
  34. package/lib/md038.js +7 -4
  35. package/lib/md039.js +6 -4
  36. package/lib/md042.js +17 -10
  37. package/lib/md043.js +2 -2
  38. package/lib/md044.js +20 -9
  39. package/lib/md046.js +14 -13
  40. package/lib/md048.js +13 -14
  41. package/lib/md049-md050.js +73 -0
  42. package/lib/md051.js +87 -0
  43. package/lib/md052.js +35 -0
  44. package/lib/md053.js +52 -0
  45. package/lib/rules.js +6 -4
  46. package/package.json +36 -29
  47. package/schema/.markdownlint.jsonc +15 -2
  48. package/schema/.markdownlint.yaml +14 -1
  49. package/schema/markdownlint-config-schema.json +119 -737
  50. package/lib/md049.js +0 -45
  51. package/lib/md050.js +0 -45
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "markdownlint-rule-helpers",
3
- "version": "0.16.0",
3
+ "version": "0.17.1",
4
4
  "description": "A collection of markdownlint helper functions for custom rules",
5
- "main": "helpers.js",
5
+ "main": "./helpers.js",
6
+ "exports": "./helpers.js",
6
7
  "author": "David Anson (https://dlaa.me/)",
7
8
  "license": "MIT",
8
9
  "homepage": "https://github.com/DavidAnson/markdownlint",
@@ -11,6 +12,9 @@
11
12
  "url": "https://github.com/DavidAnson/markdownlint.git"
12
13
  },
13
14
  "bugs": "https://github.com/DavidAnson/markdownlint/issues",
15
+ "engines": {
16
+ "node": ">=12"
17
+ },
14
18
  "keywords": [
15
19
  "markdownlint",
16
20
  "markdownlint-rule"
package/lib/cache.js CHANGED
@@ -2,32 +2,22 @@
2
2
 
3
3
  "use strict";
4
4
 
5
- let codeBlockAndSpanRanges = null;
6
- module.exports.codeBlockAndSpanRanges = (value) => {
7
- if (value) {
8
- codeBlockAndSpanRanges = value;
9
- }
10
- return codeBlockAndSpanRanges;
11
- };
12
-
13
- let flattenedLists = null;
14
- module.exports.flattenedLists = (value) => {
15
- if (value) {
16
- flattenedLists = value;
17
- }
18
- return flattenedLists;
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
- codeBlockAndSpanRanges = null;
31
- flattenedLists = 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");
package/lib/constants.js CHANGED
@@ -4,4 +4,4 @@
4
4
 
5
5
  module.exports.deprecatedRuleNames = [ "MD002", "MD006" ];
6
6
  module.exports.homepage = "https://github.com/DavidAnson/markdownlint";
7
- module.exports.version = "0.25.0";
7
+ module.exports.version = "0.26.1";
@@ -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.
@@ -346,7 +350,7 @@ type FixInfo = {
346
350
  };
347
351
  /**
348
352
  * Configuration object for linting rules. For a detailed schema, see
349
- * {@link ../schema/markdownlint-config-schema.json}.
353
+ * {@link ../schema/markdownlint-config-schema.json}.
350
354
  */
351
355
  type Configuration = {
352
356
  [x: string]: RuleConfiguration;