@dougis/markdown-lint-mcp 1.0.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 (246) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/CONTRIBUTING.md +474 -0
  3. package/LICENSE +21 -0
  4. package/README.md +240 -0
  5. package/USAGE.md +40 -0
  6. package/dist/index.d.ts +3 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +39 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/rules/index.d.ts +22 -0
  11. package/dist/rules/index.d.ts.map +1 -0
  12. package/dist/rules/index.js +144 -0
  13. package/dist/rules/index.js.map +1 -0
  14. package/dist/rules/md001.d.ts +25 -0
  15. package/dist/rules/md001.d.ts.map +1 -0
  16. package/dist/rules/md001.js +79 -0
  17. package/dist/rules/md001.js.map +1 -0
  18. package/dist/rules/md003.d.ts +41 -0
  19. package/dist/rules/md003.d.ts.map +1 -0
  20. package/dist/rules/md003.js +130 -0
  21. package/dist/rules/md003.js.map +1 -0
  22. package/dist/rules/md004.d.ts +28 -0
  23. package/dist/rules/md004.d.ts.map +1 -0
  24. package/dist/rules/md004.js +79 -0
  25. package/dist/rules/md004.js.map +1 -0
  26. package/dist/rules/md005.d.ts +21 -0
  27. package/dist/rules/md005.d.ts.map +1 -0
  28. package/dist/rules/md005.js +88 -0
  29. package/dist/rules/md005.js.map +1 -0
  30. package/dist/rules/md007.d.ts +21 -0
  31. package/dist/rules/md007.d.ts.map +1 -0
  32. package/dist/rules/md007.js +66 -0
  33. package/dist/rules/md007.js.map +1 -0
  34. package/dist/rules/md009.d.ts +35 -0
  35. package/dist/rules/md009.d.ts.map +1 -0
  36. package/dist/rules/md009.js +122 -0
  37. package/dist/rules/md009.js.map +1 -0
  38. package/dist/rules/md010.d.ts +34 -0
  39. package/dist/rules/md010.d.ts.map +1 -0
  40. package/dist/rules/md010.js +75 -0
  41. package/dist/rules/md010.js.map +1 -0
  42. package/dist/rules/md011.d.ts +30 -0
  43. package/dist/rules/md011.d.ts.map +1 -0
  44. package/dist/rules/md011.js +123 -0
  45. package/dist/rules/md011.js.map +1 -0
  46. package/dist/rules/md012.d.ts +33 -0
  47. package/dist/rules/md012.d.ts.map +1 -0
  48. package/dist/rules/md012.js +125 -0
  49. package/dist/rules/md012.js.map +1 -0
  50. package/dist/rules/md013.d.ts +26 -0
  51. package/dist/rules/md013.d.ts.map +1 -0
  52. package/dist/rules/md013.js +32 -0
  53. package/dist/rules/md013.js.map +1 -0
  54. package/dist/rules/md014.d.ts +29 -0
  55. package/dist/rules/md014.d.ts.map +1 -0
  56. package/dist/rules/md014.js +176 -0
  57. package/dist/rules/md014.js.map +1 -0
  58. package/dist/rules/md018.d.ts +22 -0
  59. package/dist/rules/md018.d.ts.map +1 -0
  60. package/dist/rules/md018.js +27 -0
  61. package/dist/rules/md018.js.map +1 -0
  62. package/dist/rules/md019.d.ts +22 -0
  63. package/dist/rules/md019.d.ts.map +1 -0
  64. package/dist/rules/md019.js +27 -0
  65. package/dist/rules/md019.js.map +1 -0
  66. package/dist/rules/md020.d.ts +22 -0
  67. package/dist/rules/md020.d.ts.map +1 -0
  68. package/dist/rules/md020.js +27 -0
  69. package/dist/rules/md020.js.map +1 -0
  70. package/dist/rules/md021.d.ts +22 -0
  71. package/dist/rules/md021.d.ts.map +1 -0
  72. package/dist/rules/md021.js +27 -0
  73. package/dist/rules/md021.js.map +1 -0
  74. package/dist/rules/md022.d.ts +21 -0
  75. package/dist/rules/md022.d.ts.map +1 -0
  76. package/dist/rules/md022.js +43 -0
  77. package/dist/rules/md022.js.map +1 -0
  78. package/dist/rules/md023.d.ts +21 -0
  79. package/dist/rules/md023.d.ts.map +1 -0
  80. package/dist/rules/md023.js +34 -0
  81. package/dist/rules/md023.js.map +1 -0
  82. package/dist/rules/md024.d.ts +30 -0
  83. package/dist/rules/md024.d.ts.map +1 -0
  84. package/dist/rules/md024.js +123 -0
  85. package/dist/rules/md024.js.map +1 -0
  86. package/dist/rules/md025.d.ts +34 -0
  87. package/dist/rules/md025.d.ts.map +1 -0
  88. package/dist/rules/md025.js +134 -0
  89. package/dist/rules/md025.js.map +1 -0
  90. package/dist/rules/md026.d.ts +21 -0
  91. package/dist/rules/md026.d.ts.map +1 -0
  92. package/dist/rules/md026.js +31 -0
  93. package/dist/rules/md026.js.map +1 -0
  94. package/dist/rules/md027.d.ts +22 -0
  95. package/dist/rules/md027.d.ts.map +1 -0
  96. package/dist/rules/md027.js +27 -0
  97. package/dist/rules/md027.js.map +1 -0
  98. package/dist/rules/md028.d.ts +37 -0
  99. package/dist/rules/md028.d.ts.map +1 -0
  100. package/dist/rules/md028.js +84 -0
  101. package/dist/rules/md028.js.map +1 -0
  102. package/dist/rules/md029.d.ts +30 -0
  103. package/dist/rules/md029.d.ts.map +1 -0
  104. package/dist/rules/md029.js +36 -0
  105. package/dist/rules/md029.js.map +1 -0
  106. package/dist/rules/md030.d.ts +28 -0
  107. package/dist/rules/md030.d.ts.map +1 -0
  108. package/dist/rules/md030.js +76 -0
  109. package/dist/rules/md030.js.map +1 -0
  110. package/dist/rules/md031.d.ts +22 -0
  111. package/dist/rules/md031.d.ts.map +1 -0
  112. package/dist/rules/md031.js +55 -0
  113. package/dist/rules/md031.js.map +1 -0
  114. package/dist/rules/md032.d.ts +21 -0
  115. package/dist/rules/md032.d.ts.map +1 -0
  116. package/dist/rules/md032.js +69 -0
  117. package/dist/rules/md032.js.map +1 -0
  118. package/dist/rules/md033.d.ts +28 -0
  119. package/dist/rules/md033.d.ts.map +1 -0
  120. package/dist/rules/md033.js +34 -0
  121. package/dist/rules/md033.js.map +1 -0
  122. package/dist/rules/md034.d.ts +28 -0
  123. package/dist/rules/md034.d.ts.map +1 -0
  124. package/dist/rules/md034.js +100 -0
  125. package/dist/rules/md034.js.map +1 -0
  126. package/dist/rules/md035.d.ts +23 -0
  127. package/dist/rules/md035.d.ts.map +1 -0
  128. package/dist/rules/md035.js +52 -0
  129. package/dist/rules/md035.js.map +1 -0
  130. package/dist/rules/md036.d.ts +34 -0
  131. package/dist/rules/md036.d.ts.map +1 -0
  132. package/dist/rules/md036.js +112 -0
  133. package/dist/rules/md036.js.map +1 -0
  134. package/dist/rules/md037.d.ts +28 -0
  135. package/dist/rules/md037.d.ts.map +1 -0
  136. package/dist/rules/md037.js +122 -0
  137. package/dist/rules/md037.js.map +1 -0
  138. package/dist/rules/md038.d.ts +28 -0
  139. package/dist/rules/md038.d.ts.map +1 -0
  140. package/dist/rules/md038.js +62 -0
  141. package/dist/rules/md038.js.map +1 -0
  142. package/dist/rules/md039.d.ts +21 -0
  143. package/dist/rules/md039.d.ts.map +1 -0
  144. package/dist/rules/md039.js +34 -0
  145. package/dist/rules/md039.js.map +1 -0
  146. package/dist/rules/md040.d.ts +21 -0
  147. package/dist/rules/md040.d.ts.map +1 -0
  148. package/dist/rules/md040.js +46 -0
  149. package/dist/rules/md040.js.map +1 -0
  150. package/dist/rules/md041.d.ts +33 -0
  151. package/dist/rules/md041.d.ts.map +1 -0
  152. package/dist/rules/md041.js +92 -0
  153. package/dist/rules/md041.js.map +1 -0
  154. package/dist/rules/md042.d.ts +22 -0
  155. package/dist/rules/md042.d.ts.map +1 -0
  156. package/dist/rules/md042.js +50 -0
  157. package/dist/rules/md042.js.map +1 -0
  158. package/dist/rules/md043.d.ts +39 -0
  159. package/dist/rules/md043.d.ts.map +1 -0
  160. package/dist/rules/md043.js +116 -0
  161. package/dist/rules/md043.js.map +1 -0
  162. package/dist/rules/md044.d.ts +40 -0
  163. package/dist/rules/md044.d.ts.map +1 -0
  164. package/dist/rules/md044.js +167 -0
  165. package/dist/rules/md044.js.map +1 -0
  166. package/dist/rules/md045.d.ts +22 -0
  167. package/dist/rules/md045.d.ts.map +1 -0
  168. package/dist/rules/md045.js +57 -0
  169. package/dist/rules/md045.js.map +1 -0
  170. package/dist/rules/md046.d.ts +23 -0
  171. package/dist/rules/md046.d.ts.map +1 -0
  172. package/dist/rules/md046.js +174 -0
  173. package/dist/rules/md046.js.map +1 -0
  174. package/dist/rules/md047.d.ts +22 -0
  175. package/dist/rules/md047.d.ts.map +1 -0
  176. package/dist/rules/md047.js +35 -0
  177. package/dist/rules/md047.js.map +1 -0
  178. package/dist/rules/md048.d.ts +22 -0
  179. package/dist/rules/md048.d.ts.map +1 -0
  180. package/dist/rules/md048.js +80 -0
  181. package/dist/rules/md048.js.map +1 -0
  182. package/dist/rules/md049.d.ts +33 -0
  183. package/dist/rules/md049.d.ts.map +1 -0
  184. package/dist/rules/md049.js +189 -0
  185. package/dist/rules/md049.js.map +1 -0
  186. package/dist/rules/md050.d.ts +22 -0
  187. package/dist/rules/md050.d.ts.map +1 -0
  188. package/dist/rules/md050.js +32 -0
  189. package/dist/rules/md050.js.map +1 -0
  190. package/dist/rules/md051.d.ts +23 -0
  191. package/dist/rules/md051.d.ts.map +1 -0
  192. package/dist/rules/md051.js +63 -0
  193. package/dist/rules/md051.js.map +1 -0
  194. package/dist/rules/md052.d.ts +21 -0
  195. package/dist/rules/md052.d.ts.map +1 -0
  196. package/dist/rules/md052.js +71 -0
  197. package/dist/rules/md052.js.map +1 -0
  198. package/dist/rules/md053.d.ts +21 -0
  199. package/dist/rules/md053.d.ts.map +1 -0
  200. package/dist/rules/md053.js +95 -0
  201. package/dist/rules/md053.js.map +1 -0
  202. package/dist/rules/md054.d.ts +21 -0
  203. package/dist/rules/md054.d.ts.map +1 -0
  204. package/dist/rules/md054.js +87 -0
  205. package/dist/rules/md054.js.map +1 -0
  206. package/dist/rules/md055.d.ts +22 -0
  207. package/dist/rules/md055.d.ts.map +1 -0
  208. package/dist/rules/md055.js +157 -0
  209. package/dist/rules/md055.js.map +1 -0
  210. package/dist/rules/md056.d.ts +21 -0
  211. package/dist/rules/md056.d.ts.map +1 -0
  212. package/dist/rules/md056.js +154 -0
  213. package/dist/rules/md056.js.map +1 -0
  214. package/dist/rules/md058.d.ts +27 -0
  215. package/dist/rules/md058.d.ts.map +1 -0
  216. package/dist/rules/md058.js +71 -0
  217. package/dist/rules/md058.js.map +1 -0
  218. package/dist/rules/md059.d.ts +22 -0
  219. package/dist/rules/md059.d.ts.map +1 -0
  220. package/dist/rules/md059.js +161 -0
  221. package/dist/rules/md059.js.map +1 -0
  222. package/dist/rules/rule-interface.d.ts +51 -0
  223. package/dist/rules/rule-interface.d.ts.map +1 -0
  224. package/dist/rules/rule-interface.js +2 -0
  225. package/dist/rules/rule-interface.js.map +1 -0
  226. package/dist/server.d.ts +59 -0
  227. package/dist/server.d.ts.map +1 -0
  228. package/dist/server.js +419 -0
  229. package/dist/server.js.map +1 -0
  230. package/dist/types.d.ts +74 -0
  231. package/dist/types.d.ts.map +1 -0
  232. package/dist/types.js +14 -0
  233. package/dist/types.js.map +1 -0
  234. package/dist/utils/file.d.ts +39 -0
  235. package/dist/utils/file.d.ts.map +1 -0
  236. package/dist/utils/file.js +124 -0
  237. package/dist/utils/file.js.map +1 -0
  238. package/dist/utils/logger.d.ts +61 -0
  239. package/dist/utils/logger.d.ts.map +1 -0
  240. package/dist/utils/logger.js +85 -0
  241. package/dist/utils/logger.js.map +1 -0
  242. package/dist/utils/safe-match.d.ts +4 -0
  243. package/dist/utils/safe-match.d.ts.map +1 -0
  244. package/dist/utils/safe-match.js +51 -0
  245. package/dist/utils/safe-match.js.map +1 -0
  246. package/package.json +85 -0
@@ -0,0 +1,176 @@
1
+ /**
2
+ * MD014: Dollar signs used before commands without showing output
3
+ *
4
+ * This rule is triggered when there are dollar signs ($) before shell commands
5
+ * in a code block that doesn't show command output. The dollar signs are unnecessary
6
+ * in this case and should be removed.
7
+ */
8
+ export const name = 'MD014';
9
+ export const description = 'Dollar signs used before commands without showing output';
10
+ /**
11
+ * Validate function to detect dollar signs used before commands without showing output
12
+ * @param lines Array of string lines to validate
13
+ * @param config Optional rule configuration
14
+ * @returns Array of rule violations
15
+ */
16
+ export function validate(lines, _config) {
17
+ const violations = [];
18
+ let inCodeBlock = false;
19
+ let codeBlockLanguage = '';
20
+ let codeBlockLines = [];
21
+ // Process the file line by line
22
+ for (let i = 0; i < lines.length; i++) {
23
+ const line = lines[i];
24
+ // Check for code block boundaries
25
+ if (line.trim().startsWith('```')) {
26
+ if (!inCodeBlock) {
27
+ // Start of code block
28
+ inCodeBlock = true;
29
+ codeBlockLines = [];
30
+ // Extract the language if specified
31
+ codeBlockLanguage = line.trim().substring(3).trim().toLowerCase();
32
+ }
33
+ else {
34
+ // End of code block - validate it
35
+ violations.push(...validateCodeBlock(codeBlockLines, codeBlockLanguage));
36
+ inCodeBlock = false;
37
+ }
38
+ }
39
+ else if (inCodeBlock) {
40
+ // Inside code block - collect lines
41
+ codeBlockLines.push({ line, lineNumber: i + 1 });
42
+ }
43
+ }
44
+ return violations;
45
+ }
46
+ /**
47
+ * Validate a code block for dollar signs used before commands without showing output
48
+ */
49
+ function validateCodeBlock(codeLines, language) {
50
+ const violations = [];
51
+ // Only process shell/bash/sh code blocks or code blocks without a language
52
+ const relevantLanguages = ['bash', 'sh', 'shell', 'zsh', ''];
53
+ if (!relevantLanguages.includes(language)) {
54
+ return violations; // Return no violations if not a shell code block
55
+ }
56
+ // Check if this is a command-only code block (no output)
57
+ let allCommandsWithDollar = true;
58
+ let hasNonEmptyLines = false;
59
+ for (const { line } of codeLines) {
60
+ const trimmedLine = line.trim();
61
+ if (trimmedLine === '')
62
+ continue; // Skip empty lines
63
+ hasNonEmptyLines = true;
64
+ if (!trimmedLine.startsWith('$ ')) {
65
+ allCommandsWithDollar = false;
66
+ break;
67
+ }
68
+ }
69
+ // If all lines are commands with dollar signs, report violations
70
+ if (allCommandsWithDollar && hasNonEmptyLines) {
71
+ for (const { line, lineNumber } of codeLines) {
72
+ const trimmedLine = line.trim();
73
+ if (trimmedLine.startsWith('$ ')) {
74
+ const dollarIndex = line.indexOf('$');
75
+ violations.push({
76
+ lineNumber,
77
+ details: `Dollar sign used before command without showing output: '${trimmedLine}'`,
78
+ range: [dollarIndex, 2], // $ and the space
79
+ });
80
+ }
81
+ }
82
+ }
83
+ return violations;
84
+ }
85
+ /**
86
+ * Fix code blocks by removing leading dollar signs from commands without output
87
+ * @param lines Array of string lines to fix
88
+ * @returns Fixed lines array with proper command formatting
89
+ */
90
+ export function fix(lines) {
91
+ const fixedLines = [];
92
+ let inCodeBlock = false;
93
+ let codeBlockLines = [];
94
+ let codeBlockLanguage = '';
95
+ // Process the file line by line
96
+ for (let i = 0; i < lines.length; i++) {
97
+ const line = lines[i];
98
+ // Check for code block boundaries
99
+ if (line.trim().startsWith('```')) {
100
+ if (!inCodeBlock) {
101
+ // Start of code block
102
+ inCodeBlock = true;
103
+ codeBlockLines = [];
104
+ // Extract the language if specified
105
+ codeBlockLanguage = line.trim().substring(3).trim().toLowerCase();
106
+ fixedLines.push(line); // Keep the opening fence
107
+ }
108
+ else {
109
+ // End of code block - process and add fixed code block
110
+ fixedLines.push(...fixCodeBlock(codeBlockLines, codeBlockLanguage));
111
+ fixedLines.push(line); // Keep the closing fence
112
+ inCodeBlock = false;
113
+ }
114
+ }
115
+ else if (inCodeBlock) {
116
+ // Inside code block - collect lines
117
+ codeBlockLines.push(line);
118
+ }
119
+ else {
120
+ // Outside code block - keep as is
121
+ fixedLines.push(line);
122
+ }
123
+ }
124
+ // Handle case where file ends inside a code block
125
+ if (inCodeBlock) {
126
+ fixedLines.push(...codeBlockLines);
127
+ }
128
+ return fixedLines;
129
+ }
130
+ /**
131
+ * Process code block lines to remove dollar signs where appropriate
132
+ */
133
+ function fixCodeBlock(codeLines, language) {
134
+ // Only process shell/bash/sh code blocks or code blocks without a language
135
+ const relevantLanguages = ['bash', 'sh', 'shell', 'zsh', ''];
136
+ if (!relevantLanguages.includes(language)) {
137
+ return codeLines; // Return unchanged if not a shell code block
138
+ }
139
+ // Check if this is a command-only code block (no output)
140
+ let allCommandsWithDollar = true;
141
+ let hasNonEmptyLines = false;
142
+ for (const line of codeLines) {
143
+ const trimmedLine = line.trim();
144
+ if (trimmedLine === '')
145
+ continue; // Skip empty lines
146
+ hasNonEmptyLines = true;
147
+ if (!trimmedLine.startsWith('$ ')) {
148
+ allCommandsWithDollar = false;
149
+ break;
150
+ }
151
+ }
152
+ // If all lines are commands with dollar signs, remove them
153
+ if (allCommandsWithDollar && hasNonEmptyLines) {
154
+ return codeLines.map(line => {
155
+ const trimmedLine = line.trim();
156
+ if (trimmedLine.startsWith('$ ')) {
157
+ const leadingSpaces = line.match(/^\s*/)?.[0] || '';
158
+ return leadingSpaces + trimmedLine.substring(2);
159
+ }
160
+ return line;
161
+ });
162
+ }
163
+ // Otherwise, return unchanged
164
+ return codeLines;
165
+ }
166
+ /**
167
+ * Rule implementation for MD014
168
+ */
169
+ export const rule = {
170
+ name,
171
+ description,
172
+ validate,
173
+ fix,
174
+ };
175
+ export default rule;
176
+ //# sourceMappingURL=md014.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md014.js","sourceRoot":"","sources":["../../src/rules/md014.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC;AAC5B,MAAM,CAAC,MAAM,WAAW,GAAG,0DAA0D,CAAC;AAEtF;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAe,EAAE,OAAiB;IACzD,MAAM,UAAU,GAAoB,EAAE,CAAC;IACvC,IAAI,WAAW,GAAG,KAAK,CAAC;IACxB,IAAI,iBAAiB,GAAG,EAAE,CAAC;IAC3B,IAAI,cAAc,GAAgD,EAAE,CAAC;IAErE,gCAAgC;IAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAEtB,kCAAkC;QAClC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YAClC,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjB,sBAAsB;g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,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAChC,IAAI,WAAW,KAAK,EAAE;YAAE,SAAS,CAAC,mBAAmB;QAErD,gBAAgB,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAClC,qBAAqB,GAAG,KAAK,CAAC;YAC9B,MAAM;QACR,CAAC;IACH,CAAC;IAED,2DAA2D;IAC3D,IAAI,qBAAqB,IAAI,gBAAgB,EAAE,CAAC;QAC9C,OAAO,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC1B,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YAChC,IAAI,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;gBACjC,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;gBACpD,OAAO,aAAa,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YAClD,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;IAED,8BAA8B;IAC9B,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAS;IACxB,IAAI;IACJ,WAAW;IACX,QAAQ;IACR,GAAG;CACJ,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { Rule } from './rule-interface';
2
+ /**
3
+ * MD018: No space after hash on atx style heading
4
+ *
5
+ * This rule is triggered when there is no space after the hash characters
6
+ * that open an atx style heading. This rule is consistent with the standard
7
+ * CommonMark specification.
8
+ */
9
+ export declare const name = "MD018";
10
+ export declare const description = "No space after hash on atx style heading";
11
+ /**
12
+ * Fix headings with no space after hash by adding a space
13
+ * @param lines Array of string lines to fix
14
+ * @returns Fixed lines array with proper spacing after heading hashes
15
+ */
16
+ export declare function fix(lines: string[]): string[];
17
+ /**
18
+ * Rule implementation for MD018
19
+ */
20
+ export declare const rule: Rule;
21
+ export default rule;
22
+ //# sourceMappingURL=md018.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md018.d.ts","sourceRoot":"","sources":["../../src/rules/md018.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,UAAU,CAAC;AAC5B,eAAO,MAAM,WAAW,6CAA6C,CAAC;AAEtE;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAE7C;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,IAIlB,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * MD018: No space after hash on atx style heading
3
+ *
4
+ * This rule is triggered when there is no space after the hash characters
5
+ * that open an atx style heading. This rule is consistent with the standard
6
+ * CommonMark specification.
7
+ */
8
+ export const name = 'MD018';
9
+ export const description = 'No space after hash on atx style heading';
10
+ /**
11
+ * Fix headings with no space after hash by adding a space
12
+ * @param lines Array of string lines to fix
13
+ * @returns Fixed lines array with proper spacing after heading hashes
14
+ */
15
+ export function fix(lines) {
16
+ return lines.map(line => line.replace(/^(#{1,6})([^#\s])/, '$1 $2'));
17
+ }
18
+ /**
19
+ * Rule implementation for MD018
20
+ */
21
+ export const rule = {
22
+ name,
23
+ description,
24
+ fix,
25
+ };
26
+ export default rule;
27
+ //# sourceMappingURL=md018.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md018.js","sourceRoot":"","sources":["../../src/rules/md018.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC;AAC5B,MAAM,CAAC,MAAM,WAAW,GAAG,0CAA0C,CAAC;AAEtE;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,KAAe;IACjC,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC,CAAC;AACvE,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAS;IACxB,IAAI;IACJ,WAAW;IACX,GAAG;CACJ,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { Rule } from './rule-interface';
2
+ /**
3
+ * MD019: Multiple spaces after hash on atx style heading
4
+ *
5
+ * This rule is triggered when more than one space is used to separate the
6
+ * opening hash characters from the heading text in an atx style heading.
7
+ * This rule is consistent with the standard CommonMark specification.
8
+ */
9
+ export declare const name = "MD019";
10
+ export declare const description = "Multiple spaces after hash on atx style heading";
11
+ /**
12
+ * Fix headings with multiple spaces after hash by reducing to a single space
13
+ * @param lines Array of string lines to fix
14
+ * @returns Fixed lines array with proper spacing after heading hashes
15
+ */
16
+ export declare function fix(lines: string[]): string[];
17
+ /**
18
+ * Rule implementation for MD019
19
+ */
20
+ export declare const rule: Rule;
21
+ export default rule;
22
+ //# sourceMappingURL=md019.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md019.d.ts","sourceRoot":"","sources":["../../src/rules/md019.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,UAAU,CAAC;AAC5B,eAAO,MAAM,WAAW,oDAAoD,CAAC;AAE7E;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAE7C;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,IAIlB,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * MD019: Multiple spaces after hash on atx style heading
3
+ *
4
+ * This rule is triggered when more than one space is used to separate the
5
+ * opening hash characters from the heading text in an atx style heading.
6
+ * This rule is consistent with the standard CommonMark specification.
7
+ */
8
+ export const name = 'MD019';
9
+ export const description = 'Multiple spaces after hash on atx style heading';
10
+ /**
11
+ * Fix headings with multiple spaces after hash by reducing to a single space
12
+ * @param lines Array of string lines to fix
13
+ * @returns Fixed lines array with proper spacing after heading hashes
14
+ */
15
+ export function fix(lines) {
16
+ return lines.map(line => line.replace(/^(#{1,6})[ \t]{2,}/, '$1 '));
17
+ }
18
+ /**
19
+ * Rule implementation for MD019
20
+ */
21
+ export const rule = {
22
+ name,
23
+ description,
24
+ fix,
25
+ };
26
+ export default rule;
27
+ //# sourceMappingURL=md019.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md019.js","sourceRoot":"","sources":["../../src/rules/md019.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC;AAC5B,MAAM,CAAC,MAAM,WAAW,GAAG,iDAAiD,CAAC;AAE7E;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,KAAe;IACjC,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC,CAAC;AACtE,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAS;IACxB,IAAI;IACJ,WAAW;IACX,GAAG;CACJ,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { Rule } from './rule-interface';
2
+ /**
3
+ * MD020: No space inside hashes on closed atx style heading
4
+ *
5
+ * This rule is triggered when closing hash characters in an atx style heading
6
+ * are not separated from the heading text by a space. This rule is consistent
7
+ * with the standard CommonMark specification.
8
+ */
9
+ export declare const name = "MD020";
10
+ export declare const description = "No space inside hashes on closed atx style heading";
11
+ /**
12
+ * Fix headings with no space inside closing hashes by adding a space
13
+ * @param lines Array of string lines to fix
14
+ * @returns Fixed lines array with proper spacing inside closing hashes
15
+ */
16
+ export declare function fix(lines: string[]): string[];
17
+ /**
18
+ * Rule implementation for MD020
19
+ */
20
+ export declare const rule: Rule;
21
+ export default rule;
22
+ //# sourceMappingURL=md020.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md020.d.ts","sourceRoot":"","sources":["../../src/rules/md020.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,UAAU,CAAC;AAC5B,eAAO,MAAM,WAAW,uDAAuD,CAAC;AAEhF;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAE7C;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,IAIlB,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * MD020: No space inside hashes on closed atx style heading
3
+ *
4
+ * This rule is triggered when closing hash characters in an atx style heading
5
+ * are not separated from the heading text by a space. This rule is consistent
6
+ * with the standard CommonMark specification.
7
+ */
8
+ export const name = 'MD020';
9
+ export const description = 'No space inside hashes on closed atx style heading';
10
+ /**
11
+ * Fix headings with no space inside closing hashes by adding a space
12
+ * @param lines Array of string lines to fix
13
+ * @returns Fixed lines array with proper spacing inside closing hashes
14
+ */
15
+ export function fix(lines) {
16
+ return lines.map(line => line.replace(/^(#{1,6})[ \t]+([^#\s].*?)[ \t]*#$/m, '$1 $2 #'));
17
+ }
18
+ /**
19
+ * Rule implementation for MD020
20
+ */
21
+ export const rule = {
22
+ name,
23
+ description,
24
+ fix,
25
+ };
26
+ export default rule;
27
+ //# sourceMappingURL=md020.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md020.js","sourceRoot":"","sources":["../../src/rules/md020.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC;AAC5B,MAAM,CAAC,MAAM,WAAW,GAAG,oDAAoD,CAAC;AAEhF;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,KAAe;IACjC,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,qCAAqC,EAAE,SAAS,CAAC,CAAC,CAAC;AAC3F,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAS;IACxB,IAAI;IACJ,WAAW;IACX,GAAG;CACJ,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { Rule } from './rule-interface';
2
+ /**
3
+ * MD021: Multiple spaces inside hashes on closed atx style heading
4
+ *
5
+ * This rule is triggered when more than one space is used to separate the
6
+ * closing hash characters from the heading text in a closed atx style heading.
7
+ * This rule is consistent with the standard CommonMark specification.
8
+ */
9
+ export declare const name = "MD021";
10
+ export declare const description = "Multiple spaces inside hashes on closed atx style heading";
11
+ /**
12
+ * Fix headings with multiple spaces inside closing hashes by reducing to a single space
13
+ * @param lines Array of string lines to fix
14
+ * @returns Fixed lines array with proper spacing inside closing hashes
15
+ */
16
+ export declare function fix(lines: string[]): string[];
17
+ /**
18
+ * Rule implementation for MD021
19
+ */
20
+ export declare const rule: Rule;
21
+ export default rule;
22
+ //# sourceMappingURL=md021.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md021.d.ts","sourceRoot":"","sources":["../../src/rules/md021.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,UAAU,CAAC;AAC5B,eAAO,MAAM,WAAW,8DAA8D,CAAC;AAEvF;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAE7C;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,IAIlB,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * MD021: Multiple spaces inside hashes on closed atx style heading
3
+ *
4
+ * This rule is triggered when more than one space is used to separate the
5
+ * closing hash characters from the heading text in a closed atx style heading.
6
+ * This rule is consistent with the standard CommonMark specification.
7
+ */
8
+ export const name = 'MD021';
9
+ export const description = 'Multiple spaces inside hashes on closed atx style heading';
10
+ /**
11
+ * Fix headings with multiple spaces inside closing hashes by reducing to a single space
12
+ * @param lines Array of string lines to fix
13
+ * @returns Fixed lines array with proper spacing inside closing hashes
14
+ */
15
+ export function fix(lines) {
16
+ return lines.map(line => line.replace(/^(#{1,6})[ \t]+(.+?)[ \t]{2,}#$/m, '$1 $2 #'));
17
+ }
18
+ /**
19
+ * Rule implementation for MD021
20
+ */
21
+ export const rule = {
22
+ name,
23
+ description,
24
+ fix,
25
+ };
26
+ export default rule;
27
+ //# sourceMappingURL=md021.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md021.js","sourceRoot":"","sources":["../../src/rules/md021.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC;AAC5B,MAAM,CAAC,MAAM,WAAW,GAAG,2DAA2D,CAAC;AAEvF;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,KAAe;IACjC,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,kCAAkC,EAAE,SAAS,CAAC,CAAC,CAAC;AACxF,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAS;IACxB,IAAI;IACJ,WAAW;IACX,GAAG;CACJ,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { Rule } from './rule-interface';
2
+ /**
3
+ * MD022: Headings should be surrounded by blank lines
4
+ *
5
+ * This rule is triggered when headings (any style) are either not preceded or not followed by a blank line.
6
+ * This is a common formatting convention that makes it easier to visually distinguish sections of a document.
7
+ */
8
+ export declare const name = "MD022";
9
+ export declare const description = "Headings should be surrounded by blank lines";
10
+ /**
11
+ * Fix headings by ensuring they have blank lines before and after
12
+ * @param lines Array of string lines to fix
13
+ * @returns Fixed lines array with blank lines added around headings
14
+ */
15
+ export declare function fix(lines: string[]): string[];
16
+ /**
17
+ * Rule implementation for MD022
18
+ */
19
+ export declare const rule: Rule;
20
+ export default rule;
21
+ //# sourceMappingURL=md022.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md022.d.ts","sourceRoot":"","sources":["../../src/rules/md022.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC;;;;;GAKG;AACH,eAAO,MAAM,IAAI,UAAU,CAAC;AAC5B,eAAO,MAAM,WAAW,iDAAiD,CAAC;AAE1E;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAwB7C;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,IAIlB,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * MD022: Headings should be surrounded by blank lines
3
+ *
4
+ * This rule is triggered when headings (any style) are either not preceded or not followed by a blank line.
5
+ * This is a common formatting convention that makes it easier to visually distinguish sections of a document.
6
+ */
7
+ export const name = 'MD022';
8
+ export const description = 'Headings should be surrounded by blank lines';
9
+ /**
10
+ * Fix headings by ensuring they have blank lines before and after
11
+ * @param lines Array of string lines to fix
12
+ * @returns Fixed lines array with blank lines added around headings
13
+ */
14
+ export function fix(lines) {
15
+ const result = [];
16
+ const isHeading = (line) => /^#{1,6}(\s+|$)/.test(line);
17
+ // Process lines one by one
18
+ for (let i = 0; i < lines.length; i++) {
19
+ const line = lines[i];
20
+ const isCurrentLineHeading = isHeading(line);
21
+ // Check if we need to add a blank line before a heading
22
+ if (isCurrentLineHeading && i > 0 && lines[i - 1].trim() !== '') {
23
+ result.push(''); // Add blank line before heading
24
+ }
25
+ // Add the current line
26
+ result.push(line);
27
+ // Check if we need to add a blank line after a heading
28
+ if (isCurrentLineHeading && i < lines.length - 1 && lines[i + 1].trim() !== '') {
29
+ result.push(''); // Add blank line after heading
30
+ }
31
+ }
32
+ return result;
33
+ }
34
+ /**
35
+ * Rule implementation for MD022
36
+ */
37
+ export const rule = {
38
+ name,
39
+ description,
40
+ fix,
41
+ };
42
+ export default rule;
43
+ //# sourceMappingURL=md022.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md022.js","sourceRoot":"","sources":["../../src/rules/md022.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC;AAC5B,MAAM,CAAC,MAAM,WAAW,GAAG,8CAA8C,CAAC;AAE1E;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,KAAe;IACjC,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,SAAS,GAAG,CAAC,IAAY,EAAW,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEzE,2BAA2B;IAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB,MAAM,oBAAoB,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;QAE7C,wDAAwD;QACxD,IAAI,oBAAoB,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YAChE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,gCAAgC;QACnD,CAAC;QAED,uBAAuB;QACvB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAElB,uDAAuD;QACvD,IAAI,oBAAoB,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YAC/E,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,+BAA+B;QAClD,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAS;IACxB,IAAI;IACJ,WAAW;IACX,GAAG;CACJ,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { Rule } from './rule-interface';
2
+ /**
3
+ * MD023: Headings must start at the beginning of the line
4
+ *
5
+ * This rule is triggered when headings (any style) don't start at the beginning of the line.
6
+ * Having whitespace before a heading can lead to rendering issues and inconsistent styling.
7
+ */
8
+ export declare const name = "MD023";
9
+ export declare const description = "Headings must start at the beginning of the line";
10
+ /**
11
+ * Fix headings by removing leading whitespace
12
+ * @param lines Array of string lines to fix
13
+ * @returns Fixed lines array with headings starting at the beginning of each line
14
+ */
15
+ export declare function fix(lines: string[]): string[];
16
+ /**
17
+ * Rule implementation for MD023
18
+ */
19
+ export declare const rule: Rule;
20
+ export default rule;
21
+ //# sourceMappingURL=md023.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md023.d.ts","sourceRoot":"","sources":["../../src/rules/md023.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC;;;;;GAKG;AACH,eAAO,MAAM,IAAI,UAAU,CAAC;AAC5B,eAAO,MAAM,WAAW,qDAAqD,CAAC;AAE9E;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAU7C;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,IAIlB,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * MD023: Headings must start at the beginning of the line
3
+ *
4
+ * This rule is triggered when headings (any style) don't start at the beginning of the line.
5
+ * Having whitespace before a heading can lead to rendering issues and inconsistent styling.
6
+ */
7
+ export const name = 'MD023';
8
+ export const description = 'Headings must start at the beginning of the line';
9
+ /**
10
+ * Fix headings by removing leading whitespace
11
+ * @param lines Array of string lines to fix
12
+ * @returns Fixed lines array with headings starting at the beginning of each line
13
+ */
14
+ export function fix(lines) {
15
+ return lines.map(line => {
16
+ // Check if this is a heading with leading whitespace
17
+ const headingMatch = line.match(/^\s+(#{1,6}\s+.+)$/);
18
+ if (headingMatch) {
19
+ // Remove the leading whitespace
20
+ return headingMatch[1];
21
+ }
22
+ return line;
23
+ });
24
+ }
25
+ /**
26
+ * Rule implementation for MD023
27
+ */
28
+ export const rule = {
29
+ name,
30
+ description,
31
+ fix,
32
+ };
33
+ export default rule;
34
+ //# sourceMappingURL=md023.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md023.js","sourceRoot":"","sources":["../../src/rules/md023.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC;AAC5B,MAAM,CAAC,MAAM,WAAW,GAAG,kDAAkD,CAAC;AAE9E;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,KAAe;IACjC,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QACtB,qDAAqD;QACrD,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACtD,IAAI,YAAY,EAAE,CAAC;YACjB,gCAAgC;YAChC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAS;IACxB,IAAI;IACJ,WAAW;IACX,GAAG;CACJ,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { Rule } from './rule-interface';
2
+ /**
3
+ * MD024: Multiple headings with the same content
4
+ *
5
+ * This rule is triggered when multiple headings in the document have the same text content.
6
+ * The rule can be configured to allow this behavior for siblings (headings at the same level)
7
+ * while still preventing duplicate headings across different levels.
8
+ */
9
+ export declare const name = "MD024";
10
+ export declare const description = "Multiple headings with the same content";
11
+ /**
12
+ * Configuration options for MD024
13
+ */
14
+ interface MD024Config {
15
+ allow_different_nesting?: boolean;
16
+ siblings_only?: boolean;
17
+ }
18
+ /**
19
+ * Fix markdown content to make heading content unique
20
+ * @param lines Array of string lines to fix
21
+ * @param config Optional configuration object
22
+ * @returns Fixed lines array with unique heading content
23
+ */
24
+ export declare function fix(lines: string[], config?: MD024Config): string[];
25
+ /**
26
+ * Rule implementation for MD024
27
+ */
28
+ export declare const rule: Rule;
29
+ export default rule;
30
+ //# sourceMappingURL=md024.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md024.d.ts","sourceRoot":"","sources":["../../src/rules/md024.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,UAAU,CAAC;AAC5B,eAAO,MAAM,WAAW,4CAA4C,CAAC;AAErE;;GAEG;AACH,UAAU,WAAW;IACnB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAYD;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE,CA6GnE;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,IAIlB,CAAC;AAEF,eAAe,IAAI,CAAC"}