markdownlint 0.34.0 → 0.35.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 (76) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +25 -10
  3. package/demo/markdownlint-browser.js +1144 -1166
  4. package/doc/CustomRules.md +11 -6
  5. package/doc/Rules.md +66 -0
  6. package/doc/md034.md +5 -0
  7. package/doc/md044.md +10 -0
  8. package/doc/md058.md +48 -0
  9. package/helpers/README.md +3 -29
  10. package/helpers/helpers.js +56 -288
  11. package/helpers/micromark.cjs +111 -12
  12. package/helpers/package.json +1 -1
  13. package/lib/cache.js +62 -13
  14. package/lib/configuration-strict.d.ts +1185 -0
  15. package/lib/configuration.d.ts +3 -1173
  16. package/lib/constants.js +3 -2
  17. package/lib/markdownlint.d.ts +65 -56
  18. package/lib/markdownlint.js +59 -37
  19. package/lib/md001.js +15 -9
  20. package/lib/md003.js +14 -9
  21. package/lib/md004.js +55 -48
  22. package/lib/md005.js +4 -13
  23. package/lib/md007.js +5 -9
  24. package/lib/md009.js +50 -44
  25. package/lib/md010.js +48 -33
  26. package/lib/md011.js +16 -8
  27. package/lib/md012.js +17 -9
  28. package/lib/md013.js +44 -38
  29. package/lib/md014.js +35 -38
  30. package/lib/md018.js +17 -9
  31. package/lib/md019-md021.js +80 -0
  32. package/lib/md020.js +13 -7
  33. package/lib/md022.js +6 -16
  34. package/lib/md023.js +22 -23
  35. package/lib/md024.js +12 -9
  36. package/lib/md025.js +15 -10
  37. package/lib/md026.js +2 -7
  38. package/lib/md027.js +5 -10
  39. package/lib/md028.js +3 -8
  40. package/lib/md029.js +40 -34
  41. package/lib/md030.js +4 -10
  42. package/lib/md031.js +43 -23
  43. package/lib/md032.js +16 -26
  44. package/lib/md033.js +3 -8
  45. package/lib/md034.js +5 -10
  46. package/lib/md035.js +2 -7
  47. package/lib/md036.js +3 -2
  48. package/lib/md037.js +2 -7
  49. package/lib/md038.js +3 -9
  50. package/lib/md039.js +66 -54
  51. package/lib/md040.js +3 -8
  52. package/lib/md041.js +1 -1
  53. package/lib/md042.js +48 -38
  54. package/lib/md043.js +20 -14
  55. package/lib/md044.js +3 -8
  56. package/lib/md045.js +3 -8
  57. package/lib/md046.js +2 -8
  58. package/lib/md048.js +3 -7
  59. package/lib/md049-md050.js +2 -7
  60. package/lib/md051.js +6 -12
  61. package/lib/md052.js +2 -2
  62. package/lib/md053.js +2 -2
  63. package/lib/md054.js +8 -13
  64. package/lib/md055.js +7 -8
  65. package/lib/md056.js +15 -11
  66. package/lib/md058.js +43 -0
  67. package/lib/rules.js +11 -4
  68. package/package.json +19 -17
  69. package/schema/.markdownlint.jsonc +54 -51
  70. package/schema/.markdownlint.yaml +53 -50
  71. package/schema/ValidatingConfiguration.md +6 -8
  72. package/schema/markdownlint-config-schema-strict.json +1819 -0
  73. package/schema/markdownlint-config-schema.json +115 -105
  74. package/style/prettier.json +1 -0
  75. package/lib/md019.js +0 -42
  76. package/lib/md021.js +0 -65
@@ -7,6 +7,7 @@
7
7
  "code-fence-style": false,
8
8
  "emphasis-style": false,
9
9
  "heading-start-left": false,
10
+ "heading-style": false,
10
11
  "hr-style": false,
11
12
  "line-length": false,
12
13
  "list-indent": false,
package/lib/md019.js DELETED
@@ -1,42 +0,0 @@
1
- // @ts-check
2
-
3
- "use strict";
4
-
5
- const { addErrorContext, filterTokens, headingStyleFor } =
6
- require("../helpers");
7
-
8
- // eslint-disable-next-line jsdoc/valid-types
9
- /** @type import("./markdownlint").Rule */
10
- module.exports = {
11
- "names": [ "MD019", "no-multiple-space-atx" ],
12
- "description": "Multiple spaces after hash on atx style heading",
13
- "tags": [ "headings", "atx", "spaces" ],
14
- "parser": "markdownit",
15
- "function": function MD019(params, onError) {
16
- filterTokens(params, "heading_open", (token) => {
17
- if (headingStyleFor(token) === "atx") {
18
- const { line, lineNumber } = token;
19
- const match = /^(#+)([ \t]{2,})\S/.exec(line);
20
- if (match) {
21
- const [
22
- ,
23
- { "length": hashLength },
24
- { "length": spacesLength }
25
- ] = match;
26
- addErrorContext(
27
- onError,
28
- lineNumber,
29
- line.trim(),
30
- null,
31
- null,
32
- [ 1, hashLength + spacesLength + 1 ],
33
- {
34
- "editColumn": hashLength + 1,
35
- "deleteCount": spacesLength - 1
36
- }
37
- );
38
- }
39
- }
40
- });
41
- }
42
- };
package/lib/md021.js DELETED
@@ -1,65 +0,0 @@
1
- // @ts-check
2
-
3
- "use strict";
4
-
5
- const { addErrorContext, filterTokens, headingStyleFor } =
6
- require("../helpers");
7
-
8
- const closedAtxRe = /^(#+)([ \t]+)([^ \t]|[^ \t].*[^ \t])([ \t]+)(#+)(\s*)$/;
9
-
10
- // eslint-disable-next-line jsdoc/valid-types
11
- /** @type import("./markdownlint").Rule */
12
- module.exports = {
13
- "names": [ "MD021", "no-multiple-space-closed-atx" ],
14
- "description": "Multiple spaces inside hashes on closed atx style heading",
15
- "tags": [ "headings", "atx_closed", "spaces" ],
16
- "parser": "markdownit",
17
- "function": function MD021(params, onError) {
18
- filterTokens(params, "heading_open", (token) => {
19
- if (headingStyleFor(token) === "atx_closed") {
20
- const { line, lineNumber } = token;
21
- const match = closedAtxRe.exec(line);
22
- if (match) {
23
- const [
24
- ,
25
- leftHash,
26
- { "length": leftSpaceLength },
27
- content,
28
- { "length": rightSpaceLength },
29
- rightHash,
30
- { "length": trailSpaceLength }
31
- ] = match;
32
- const left = leftSpaceLength > 1;
33
- const right = rightSpaceLength > 1;
34
- if (left || right) {
35
- const length = line.length;
36
- const leftHashLength = leftHash.length;
37
- const rightHashLength = rightHash.length;
38
- const range = left ?
39
- [
40
- 1,
41
- leftHashLength + leftSpaceLength + 1
42
- ] :
43
- [
44
- length - trailSpaceLength - rightHashLength - rightSpaceLength,
45
- rightSpaceLength + rightHashLength + 1
46
- ];
47
- addErrorContext(
48
- onError,
49
- lineNumber,
50
- line.trim(),
51
- left,
52
- right,
53
- range,
54
- {
55
- "editColumn": 1,
56
- "deleteCount": length,
57
- "insertText": `${leftHash} ${content} ${rightHash}`
58
- }
59
- );
60
- }
61
- }
62
- }
63
- });
64
- }
65
- };