@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.
- package/CHANGELOG.md +80 -0
- package/CONTRIBUTING.md +474 -0
- package/LICENSE +21 -0
- package/README.md +240 -0
- package/USAGE.md +40 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/rules/index.d.ts +22 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +144 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/md001.d.ts +25 -0
- package/dist/rules/md001.d.ts.map +1 -0
- package/dist/rules/md001.js +79 -0
- package/dist/rules/md001.js.map +1 -0
- package/dist/rules/md003.d.ts +41 -0
- package/dist/rules/md003.d.ts.map +1 -0
- package/dist/rules/md003.js +130 -0
- package/dist/rules/md003.js.map +1 -0
- package/dist/rules/md004.d.ts +28 -0
- package/dist/rules/md004.d.ts.map +1 -0
- package/dist/rules/md004.js +79 -0
- package/dist/rules/md004.js.map +1 -0
- package/dist/rules/md005.d.ts +21 -0
- package/dist/rules/md005.d.ts.map +1 -0
- package/dist/rules/md005.js +88 -0
- package/dist/rules/md005.js.map +1 -0
- package/dist/rules/md007.d.ts +21 -0
- package/dist/rules/md007.d.ts.map +1 -0
- package/dist/rules/md007.js +66 -0
- package/dist/rules/md007.js.map +1 -0
- package/dist/rules/md009.d.ts +35 -0
- package/dist/rules/md009.d.ts.map +1 -0
- package/dist/rules/md009.js +122 -0
- package/dist/rules/md009.js.map +1 -0
- package/dist/rules/md010.d.ts +34 -0
- package/dist/rules/md010.d.ts.map +1 -0
- package/dist/rules/md010.js +75 -0
- package/dist/rules/md010.js.map +1 -0
- package/dist/rules/md011.d.ts +30 -0
- package/dist/rules/md011.d.ts.map +1 -0
- package/dist/rules/md011.js +123 -0
- package/dist/rules/md011.js.map +1 -0
- package/dist/rules/md012.d.ts +33 -0
- package/dist/rules/md012.d.ts.map +1 -0
- package/dist/rules/md012.js +125 -0
- package/dist/rules/md012.js.map +1 -0
- package/dist/rules/md013.d.ts +26 -0
- package/dist/rules/md013.d.ts.map +1 -0
- package/dist/rules/md013.js +32 -0
- package/dist/rules/md013.js.map +1 -0
- package/dist/rules/md014.d.ts +29 -0
- package/dist/rules/md014.d.ts.map +1 -0
- package/dist/rules/md014.js +176 -0
- package/dist/rules/md014.js.map +1 -0
- package/dist/rules/md018.d.ts +22 -0
- package/dist/rules/md018.d.ts.map +1 -0
- package/dist/rules/md018.js +27 -0
- package/dist/rules/md018.js.map +1 -0
- package/dist/rules/md019.d.ts +22 -0
- package/dist/rules/md019.d.ts.map +1 -0
- package/dist/rules/md019.js +27 -0
- package/dist/rules/md019.js.map +1 -0
- package/dist/rules/md020.d.ts +22 -0
- package/dist/rules/md020.d.ts.map +1 -0
- package/dist/rules/md020.js +27 -0
- package/dist/rules/md020.js.map +1 -0
- package/dist/rules/md021.d.ts +22 -0
- package/dist/rules/md021.d.ts.map +1 -0
- package/dist/rules/md021.js +27 -0
- package/dist/rules/md021.js.map +1 -0
- package/dist/rules/md022.d.ts +21 -0
- package/dist/rules/md022.d.ts.map +1 -0
- package/dist/rules/md022.js +43 -0
- package/dist/rules/md022.js.map +1 -0
- package/dist/rules/md023.d.ts +21 -0
- package/dist/rules/md023.d.ts.map +1 -0
- package/dist/rules/md023.js +34 -0
- package/dist/rules/md023.js.map +1 -0
- package/dist/rules/md024.d.ts +30 -0
- package/dist/rules/md024.d.ts.map +1 -0
- package/dist/rules/md024.js +123 -0
- package/dist/rules/md024.js.map +1 -0
- package/dist/rules/md025.d.ts +34 -0
- package/dist/rules/md025.d.ts.map +1 -0
- package/dist/rules/md025.js +134 -0
- package/dist/rules/md025.js.map +1 -0
- package/dist/rules/md026.d.ts +21 -0
- package/dist/rules/md026.d.ts.map +1 -0
- package/dist/rules/md026.js +31 -0
- package/dist/rules/md026.js.map +1 -0
- package/dist/rules/md027.d.ts +22 -0
- package/dist/rules/md027.d.ts.map +1 -0
- package/dist/rules/md027.js +27 -0
- package/dist/rules/md027.js.map +1 -0
- package/dist/rules/md028.d.ts +37 -0
- package/dist/rules/md028.d.ts.map +1 -0
- package/dist/rules/md028.js +84 -0
- package/dist/rules/md028.js.map +1 -0
- package/dist/rules/md029.d.ts +30 -0
- package/dist/rules/md029.d.ts.map +1 -0
- package/dist/rules/md029.js +36 -0
- package/dist/rules/md029.js.map +1 -0
- package/dist/rules/md030.d.ts +28 -0
- package/dist/rules/md030.d.ts.map +1 -0
- package/dist/rules/md030.js +76 -0
- package/dist/rules/md030.js.map +1 -0
- package/dist/rules/md031.d.ts +22 -0
- package/dist/rules/md031.d.ts.map +1 -0
- package/dist/rules/md031.js +55 -0
- package/dist/rules/md031.js.map +1 -0
- package/dist/rules/md032.d.ts +21 -0
- package/dist/rules/md032.d.ts.map +1 -0
- package/dist/rules/md032.js +69 -0
- package/dist/rules/md032.js.map +1 -0
- package/dist/rules/md033.d.ts +28 -0
- package/dist/rules/md033.d.ts.map +1 -0
- package/dist/rules/md033.js +34 -0
- package/dist/rules/md033.js.map +1 -0
- package/dist/rules/md034.d.ts +28 -0
- package/dist/rules/md034.d.ts.map +1 -0
- package/dist/rules/md034.js +100 -0
- package/dist/rules/md034.js.map +1 -0
- package/dist/rules/md035.d.ts +23 -0
- package/dist/rules/md035.d.ts.map +1 -0
- package/dist/rules/md035.js +52 -0
- package/dist/rules/md035.js.map +1 -0
- package/dist/rules/md036.d.ts +34 -0
- package/dist/rules/md036.d.ts.map +1 -0
- package/dist/rules/md036.js +112 -0
- package/dist/rules/md036.js.map +1 -0
- package/dist/rules/md037.d.ts +28 -0
- package/dist/rules/md037.d.ts.map +1 -0
- package/dist/rules/md037.js +122 -0
- package/dist/rules/md037.js.map +1 -0
- package/dist/rules/md038.d.ts +28 -0
- package/dist/rules/md038.d.ts.map +1 -0
- package/dist/rules/md038.js +62 -0
- package/dist/rules/md038.js.map +1 -0
- package/dist/rules/md039.d.ts +21 -0
- package/dist/rules/md039.d.ts.map +1 -0
- package/dist/rules/md039.js +34 -0
- package/dist/rules/md039.js.map +1 -0
- package/dist/rules/md040.d.ts +21 -0
- package/dist/rules/md040.d.ts.map +1 -0
- package/dist/rules/md040.js +46 -0
- package/dist/rules/md040.js.map +1 -0
- package/dist/rules/md041.d.ts +33 -0
- package/dist/rules/md041.d.ts.map +1 -0
- package/dist/rules/md041.js +92 -0
- package/dist/rules/md041.js.map +1 -0
- package/dist/rules/md042.d.ts +22 -0
- package/dist/rules/md042.d.ts.map +1 -0
- package/dist/rules/md042.js +50 -0
- package/dist/rules/md042.js.map +1 -0
- package/dist/rules/md043.d.ts +39 -0
- package/dist/rules/md043.d.ts.map +1 -0
- package/dist/rules/md043.js +116 -0
- package/dist/rules/md043.js.map +1 -0
- package/dist/rules/md044.d.ts +40 -0
- package/dist/rules/md044.d.ts.map +1 -0
- package/dist/rules/md044.js +167 -0
- package/dist/rules/md044.js.map +1 -0
- package/dist/rules/md045.d.ts +22 -0
- package/dist/rules/md045.d.ts.map +1 -0
- package/dist/rules/md045.js +57 -0
- package/dist/rules/md045.js.map +1 -0
- package/dist/rules/md046.d.ts +23 -0
- package/dist/rules/md046.d.ts.map +1 -0
- package/dist/rules/md046.js +174 -0
- package/dist/rules/md046.js.map +1 -0
- package/dist/rules/md047.d.ts +22 -0
- package/dist/rules/md047.d.ts.map +1 -0
- package/dist/rules/md047.js +35 -0
- package/dist/rules/md047.js.map +1 -0
- package/dist/rules/md048.d.ts +22 -0
- package/dist/rules/md048.d.ts.map +1 -0
- package/dist/rules/md048.js +80 -0
- package/dist/rules/md048.js.map +1 -0
- package/dist/rules/md049.d.ts +33 -0
- package/dist/rules/md049.d.ts.map +1 -0
- package/dist/rules/md049.js +189 -0
- package/dist/rules/md049.js.map +1 -0
- package/dist/rules/md050.d.ts +22 -0
- package/dist/rules/md050.d.ts.map +1 -0
- package/dist/rules/md050.js +32 -0
- package/dist/rules/md050.js.map +1 -0
- package/dist/rules/md051.d.ts +23 -0
- package/dist/rules/md051.d.ts.map +1 -0
- package/dist/rules/md051.js +63 -0
- package/dist/rules/md051.js.map +1 -0
- package/dist/rules/md052.d.ts +21 -0
- package/dist/rules/md052.d.ts.map +1 -0
- package/dist/rules/md052.js +71 -0
- package/dist/rules/md052.js.map +1 -0
- package/dist/rules/md053.d.ts +21 -0
- package/dist/rules/md053.d.ts.map +1 -0
- package/dist/rules/md053.js +95 -0
- package/dist/rules/md053.js.map +1 -0
- package/dist/rules/md054.d.ts +21 -0
- package/dist/rules/md054.d.ts.map +1 -0
- package/dist/rules/md054.js +87 -0
- package/dist/rules/md054.js.map +1 -0
- package/dist/rules/md055.d.ts +22 -0
- package/dist/rules/md055.d.ts.map +1 -0
- package/dist/rules/md055.js +157 -0
- package/dist/rules/md055.js.map +1 -0
- package/dist/rules/md056.d.ts +21 -0
- package/dist/rules/md056.d.ts.map +1 -0
- package/dist/rules/md056.js +154 -0
- package/dist/rules/md056.js.map +1 -0
- package/dist/rules/md058.d.ts +27 -0
- package/dist/rules/md058.d.ts.map +1 -0
- package/dist/rules/md058.js +71 -0
- package/dist/rules/md058.js.map +1 -0
- package/dist/rules/md059.d.ts +22 -0
- package/dist/rules/md059.d.ts.map +1 -0
- package/dist/rules/md059.js +161 -0
- package/dist/rules/md059.js.map +1 -0
- package/dist/rules/rule-interface.d.ts +51 -0
- package/dist/rules/rule-interface.d.ts.map +1 -0
- package/dist/rules/rule-interface.js +2 -0
- package/dist/rules/rule-interface.js.map +1 -0
- package/dist/server.d.ts +59 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +419 -0
- package/dist/server.js.map +1 -0
- package/dist/types.d.ts +74 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +14 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/file.d.ts +39 -0
- package/dist/utils/file.d.ts.map +1 -0
- package/dist/utils/file.js +124 -0
- package/dist/utils/file.js.map +1 -0
- package/dist/utils/logger.d.ts +61 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +85 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/safe-match.d.ts +4 -0
- package/dist/utils/safe-match.d.ts.map +1 -0
- package/dist/utils/safe-match.js +51 -0
- package/dist/utils/safe-match.js.map +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Rule } from './rule-interface';
|
|
2
|
+
/**
|
|
3
|
+
* MD051: Link fragments should be valid
|
|
4
|
+
*
|
|
5
|
+
* This rule is triggered when a link fragment doesn't match any of the
|
|
6
|
+
* anchor IDs generated from the headings in the document.
|
|
7
|
+
*
|
|
8
|
+
* For this rule, our fix will strip invalid fragments from links when they can't be resolved.
|
|
9
|
+
*/
|
|
10
|
+
export declare const name = "MD051";
|
|
11
|
+
export declare const description = "Link fragments should be valid";
|
|
12
|
+
/**
|
|
13
|
+
* Fix invalid link fragments by removing them
|
|
14
|
+
* @param lines Array of string lines to fix
|
|
15
|
+
* @returns Fixed lines array with valid link fragments
|
|
16
|
+
*/
|
|
17
|
+
export declare function fix(lines: string[]): string[];
|
|
18
|
+
/**
|
|
19
|
+
* Rule implementation for MD051
|
|
20
|
+
*/
|
|
21
|
+
export declare const rule: Rule;
|
|
22
|
+
export default rule;
|
|
23
|
+
//# sourceMappingURL=md051.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"md051.d.ts","sourceRoot":"","sources":["../../src/rules/md051.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI,UAAU,CAAC;AAC5B,eAAO,MAAM,WAAW,mCAAmC,CAAC;AAE5D;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAmB7C;AA4BD;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,IAIlB,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MD051: Link fragments should be valid
|
|
3
|
+
*
|
|
4
|
+
* This rule is triggered when a link fragment doesn't match any of the
|
|
5
|
+
* anchor IDs generated from the headings in the document.
|
|
6
|
+
*
|
|
7
|
+
* For this rule, our fix will strip invalid fragments from links when they can't be resolved.
|
|
8
|
+
*/
|
|
9
|
+
export const name = 'MD051';
|
|
10
|
+
export const description = 'Link fragments should be valid';
|
|
11
|
+
/**
|
|
12
|
+
* Fix invalid link fragments by removing them
|
|
13
|
+
* @param lines Array of string lines to fix
|
|
14
|
+
* @returns Fixed lines array with valid link fragments
|
|
15
|
+
*/
|
|
16
|
+
export function fix(lines) {
|
|
17
|
+
// First, extract all headings to get valid fragment IDs
|
|
18
|
+
const headingIds = extractHeadingIds(lines);
|
|
19
|
+
// Then fix links with invalid fragments
|
|
20
|
+
return lines.map(line => {
|
|
21
|
+
// Match links with fragments: [text](#fragment)
|
|
22
|
+
return line.replace(/\[([^\]]+)\]\(([^)]+)(#[^)]+)\)/g, (match, text, url, fragment) => {
|
|
23
|
+
const fragmentId = fragment.substring(1); // Remove the # character
|
|
24
|
+
// Check if the fragment is valid
|
|
25
|
+
if (headingIds.includes(fragmentId)) {
|
|
26
|
+
return match; // Fragment is valid, keep as is
|
|
27
|
+
}
|
|
28
|
+
// Fragment is invalid, remove it
|
|
29
|
+
return `[${text}](${url})`;
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Extract heading IDs from the document
|
|
35
|
+
* These are usually lowercase versions of the heading text with spaces replaced by hyphens
|
|
36
|
+
*/
|
|
37
|
+
function extractHeadingIds(lines) {
|
|
38
|
+
const headingIds = [];
|
|
39
|
+
// Regular expression to match ATX headings (# Heading)
|
|
40
|
+
const atxHeadingRegex = /^#{1,6}\s+(.+?)(?:\s+#{1,6})?$/;
|
|
41
|
+
for (const line of lines) {
|
|
42
|
+
const match = line.match(atxHeadingRegex);
|
|
43
|
+
if (match) {
|
|
44
|
+
const headingText = match[1].trim();
|
|
45
|
+
const headingId = headingText
|
|
46
|
+
.toLowerCase()
|
|
47
|
+
.replace(/[^\w\s-]/g, '') // Remove special characters
|
|
48
|
+
.replace(/\s+/g, '-'); // Replace spaces with hyphens
|
|
49
|
+
headingIds.push(headingId);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return headingIds;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Rule implementation for MD051
|
|
56
|
+
*/
|
|
57
|
+
export const rule = {
|
|
58
|
+
name,
|
|
59
|
+
description,
|
|
60
|
+
fix,
|
|
61
|
+
};
|
|
62
|
+
export default rule;
|
|
63
|
+
//# sourceMappingURL=md051.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"md051.js","sourceRoot":"","sources":["../../src/rules/md051.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC;AAC5B,MAAM,CAAC,MAAM,WAAW,GAAG,gCAAgC,CAAC;AAE5D;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,KAAe;IACjC,wDAAwD;IACxD,MAAM,UAAU,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAE5C,wCAAwC;IACxC,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QACtB,gDAAgD;QAChD,OAAO,IAAI,CAAC,OAAO,CAAC,kCAAkC,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE;YACrF,MAAM,UAAU,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,yBAAyB;YAEnE,iCAAiC;YACjC,IAAI,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;gBACpC,OAAO,KAAK,CAAC,CAAC,gCAAgC;YAChD,CAAC;YAED,iCAAiC;YACjC,OAAO,IAAI,IAAI,KAAK,GAAG,GAAG,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,SAAS,iBAAiB,CAAC,KAAe;IACxC,MAAM,UAAU,GAAa,EAAE,CAAC;IAEhC,uDAAuD;IACvD,MAAM,eAAe,GAAG,gCAAgC,CAAC;IAEzD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAC1C,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YACpC,MAAM,SAAS,GAAG,WAAW;iBAC1B,WAAW,EAAE;iBACb,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,4BAA4B;iBACrD,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,8BAA8B;YAEvD,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,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
|
+
* MD052: Reference links and images should use a label that is defined
|
|
4
|
+
*
|
|
5
|
+
* This rule is triggered when reference links/images use a label that isn't defined.
|
|
6
|
+
* Our fix will convert undefined reference links to inline links when possible.
|
|
7
|
+
*/
|
|
8
|
+
export declare const name = "MD052";
|
|
9
|
+
export declare const description = "Reference links and images should use a label that is defined";
|
|
10
|
+
/**
|
|
11
|
+
* Fix undefined reference links by converting them to inline links
|
|
12
|
+
* @param lines Array of string lines to fix
|
|
13
|
+
* @returns Fixed lines array with valid reference links
|
|
14
|
+
*/
|
|
15
|
+
export declare function fix(lines: string[]): string[];
|
|
16
|
+
/**
|
|
17
|
+
* Rule implementation for MD052
|
|
18
|
+
*/
|
|
19
|
+
export declare const rule: Rule;
|
|
20
|
+
export default rule;
|
|
21
|
+
//# sourceMappingURL=md052.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"md052.d.ts","sourceRoot":"","sources":["../../src/rules/md052.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC;;;;;GAKG;AACH,eAAO,MAAM,IAAI,UAAU,CAAC;AAC5B,eAAO,MAAM,WAAW,kEAAkE,CAAC;AAE3F;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAiC7C;AA0BD;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,IAIlB,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MD052: Reference links and images should use a label that is defined
|
|
3
|
+
*
|
|
4
|
+
* This rule is triggered when reference links/images use a label that isn't defined.
|
|
5
|
+
* Our fix will convert undefined reference links to inline links when possible.
|
|
6
|
+
*/
|
|
7
|
+
export const name = 'MD052';
|
|
8
|
+
export const description = 'Reference links and images should use a label that is defined';
|
|
9
|
+
/**
|
|
10
|
+
* Fix undefined reference links by converting them to inline links
|
|
11
|
+
* @param lines Array of string lines to fix
|
|
12
|
+
* @returns Fixed lines array with valid reference links
|
|
13
|
+
*/
|
|
14
|
+
export function fix(lines) {
|
|
15
|
+
// First, extract all reference link definitions
|
|
16
|
+
const definitions = extractReferenceLinkDefinitions(lines);
|
|
17
|
+
// Then fix links with undefined references
|
|
18
|
+
return lines.map(line => {
|
|
19
|
+
// Match reference links: [text][label] or [text][]
|
|
20
|
+
return line
|
|
21
|
+
.replace(/\[([^\]]+)\]\[([^\]]*)\]/g, (match, text, label) => {
|
|
22
|
+
// For shortcut reference links [text][], the label is the text
|
|
23
|
+
const actualLabel = label || text;
|
|
24
|
+
// Check if the label is defined
|
|
25
|
+
if (definitions[actualLabel.toLowerCase()]) {
|
|
26
|
+
return match; // Label is defined, keep as is
|
|
27
|
+
}
|
|
28
|
+
// Label is undefined, convert to inline link if possible
|
|
29
|
+
// We'll use an empty URL as a placeholder, since we don't know the intended destination
|
|
30
|
+
return `[${text}]()`;
|
|
31
|
+
})
|
|
32
|
+
.replace(/!\[([^\]]+)\]\[([^\]]*)\]/g, (match, text, label) => {
|
|
33
|
+
// Similar handling for reference images
|
|
34
|
+
const actualLabel = label || text;
|
|
35
|
+
if (definitions[actualLabel.toLowerCase()]) {
|
|
36
|
+
return match; // Label is defined, keep as is
|
|
37
|
+
}
|
|
38
|
+
// Convert to inline image with empty URL
|
|
39
|
+
return `![${text}]()`;
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Extract reference link definitions from the document
|
|
45
|
+
* Returns a map of lowercase labels to their URLs
|
|
46
|
+
*/
|
|
47
|
+
function extractReferenceLinkDefinitions(lines) {
|
|
48
|
+
const definitions = {};
|
|
49
|
+
// Regular expression to match reference link definitions: [label]: url
|
|
50
|
+
const definitionRegex = /^\s*\[([^\]]+)\]:\s*(\S+)(?:\s+(?:"([^"]+)"|'([^']+)'|\(([^)]+)\)))?$/;
|
|
51
|
+
for (const line of lines) {
|
|
52
|
+
const match = line.match(definitionRegex);
|
|
53
|
+
if (match) {
|
|
54
|
+
const label = match[1].trim();
|
|
55
|
+
const url = match[2];
|
|
56
|
+
// Store the definition (case-insensitive)
|
|
57
|
+
definitions[label.toLowerCase()] = url;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return definitions;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Rule implementation for MD052
|
|
64
|
+
*/
|
|
65
|
+
export const rule = {
|
|
66
|
+
name,
|
|
67
|
+
description,
|
|
68
|
+
fix,
|
|
69
|
+
};
|
|
70
|
+
export default rule;
|
|
71
|
+
//# sourceMappingURL=md052.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"md052.js","sourceRoot":"","sources":["../../src/rules/md052.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC;AAC5B,MAAM,CAAC,MAAM,WAAW,GAAG,+DAA+D,CAAC;AAE3F;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,KAAe;IACjC,gDAAgD;IAChD,MAAM,WAAW,GAAG,+BAA+B,CAAC,KAAK,CAAC,CAAC;IAE3D,2CAA2C;IAC3C,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QACtB,mDAAmD;QACnD,OAAO,IAAI;aACR,OAAO,CAAC,2BAA2B,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;YAC3D,+DAA+D;YAC/D,MAAM,WAAW,GAAG,KAAK,IAAI,IAAI,CAAC;YAElC,gCAAgC;YAChC,IAAI,WAAW,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;gBAC3C,OAAO,KAAK,CAAC,CAAC,+BAA+B;YAC/C,CAAC;YAED,yDAAyD;YACzD,wFAAwF;YACxF,OAAO,IAAI,IAAI,KAAK,CAAC;QACvB,CAAC,CAAC;aACD,OAAO,CAAC,4BAA4B,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;YAC5D,wCAAwC;YACxC,MAAM,WAAW,GAAG,KAAK,IAAI,IAAI,CAAC;YAElC,IAAI,WAAW,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;gBAC3C,OAAO,KAAK,CAAC,CAAC,+BAA+B;YAC/C,CAAC;YAED,yCAAyC;YACzC,OAAO,KAAK,IAAI,KAAK,CAAC;QACxB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,SAAS,+BAA+B,CAAC,KAAe;IACtD,MAAM,WAAW,GAA2B,EAAE,CAAC;IAE/C,uEAAuE;IACvE,MAAM,eAAe,GAAG,uEAAuE,CAAC;IAEhG,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAC1C,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAC9B,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YAErB,0CAA0C;YAC1C,WAAW,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,GAAG,GAAG,CAAC;QACzC,CAAC;IACH,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,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
|
+
* MD053: Link and image reference definitions should be needed
|
|
4
|
+
*
|
|
5
|
+
* This rule is triggered when a reference definition is not used by any link or image.
|
|
6
|
+
* Our fix will remove unused reference definitions.
|
|
7
|
+
*/
|
|
8
|
+
export declare const name = "MD053";
|
|
9
|
+
export declare const description = "Link and image reference definitions should be needed";
|
|
10
|
+
/**
|
|
11
|
+
* Fix by removing unused reference definitions
|
|
12
|
+
* @param lines Array of string lines to fix
|
|
13
|
+
* @returns Fixed lines array with only used reference definitions
|
|
14
|
+
*/
|
|
15
|
+
export declare function fix(lines: string[]): string[];
|
|
16
|
+
/**
|
|
17
|
+
* Rule implementation for MD053
|
|
18
|
+
*/
|
|
19
|
+
export declare const rule: Rule;
|
|
20
|
+
export default rule;
|
|
21
|
+
//# sourceMappingURL=md053.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"md053.d.ts","sourceRoot":"","sources":["../../src/rules/md053.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC;;;;;GAKG;AACH,eAAO,MAAM,IAAI,UAAU,CAAC;AAC5B,eAAO,MAAM,WAAW,0DAA0D,CAAC;AAEnF;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAyB7C;AAmED;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,IAIlB,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MD053: Link and image reference definitions should be needed
|
|
3
|
+
*
|
|
4
|
+
* This rule is triggered when a reference definition is not used by any link or image.
|
|
5
|
+
* Our fix will remove unused reference definitions.
|
|
6
|
+
*/
|
|
7
|
+
export const name = 'MD053';
|
|
8
|
+
export const description = 'Link and image reference definitions should be needed';
|
|
9
|
+
/**
|
|
10
|
+
* Fix by removing unused reference definitions
|
|
11
|
+
* @param lines Array of string lines to fix
|
|
12
|
+
* @returns Fixed lines array with only used reference definitions
|
|
13
|
+
*/
|
|
14
|
+
export function fix(lines) {
|
|
15
|
+
// First, extract all reference link definitions and their line indices
|
|
16
|
+
const { definitionLines } = extractReferenceLinkDefinitions(lines);
|
|
17
|
+
// Find all reference usages
|
|
18
|
+
const usedLabels = findReferenceUsages(lines);
|
|
19
|
+
// Filter out lines with unused reference definitions
|
|
20
|
+
return lines.filter((line, index) => {
|
|
21
|
+
// If this is not a definition line, keep it
|
|
22
|
+
if (!definitionLines.includes(index)) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
// Find which definition this line corresponds to
|
|
26
|
+
const definitionMatch = line.match(/^\s*\[([^\]]+)\]:/);
|
|
27
|
+
if (!definitionMatch) {
|
|
28
|
+
return true; // Shouldn't happen, but keep the line if no match
|
|
29
|
+
}
|
|
30
|
+
const label = definitionMatch[1].trim().toLowerCase();
|
|
31
|
+
// Keep the line if the reference is used
|
|
32
|
+
return usedLabels.includes(label);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Extract reference link definitions from the document
|
|
37
|
+
* Returns both the definitions and their line indices
|
|
38
|
+
*/
|
|
39
|
+
function extractReferenceLinkDefinitions(lines) {
|
|
40
|
+
const definitions = {};
|
|
41
|
+
const definitionLines = [];
|
|
42
|
+
// Regular expression to match reference link definitions: [label]: url
|
|
43
|
+
const definitionRegex = /^\s*\[([^\]]+)\]:\s*(\S+)(?:\s+(?:"([^"]+)"|'([^']+)'|\(([^)]+)\)))?$/;
|
|
44
|
+
for (let i = 0; i < lines.length; i++) {
|
|
45
|
+
const line = lines[i];
|
|
46
|
+
const match = line.match(definitionRegex);
|
|
47
|
+
if (match) {
|
|
48
|
+
const label = match[1].trim();
|
|
49
|
+
const url = match[2];
|
|
50
|
+
// Store the definition (case-insensitive)
|
|
51
|
+
definitions[label.toLowerCase()] = url;
|
|
52
|
+
definitionLines.push(i);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return { definitions, definitionLines };
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Find all reference usages in the document
|
|
59
|
+
* Returns an array of lowercase labels that are used
|
|
60
|
+
*/
|
|
61
|
+
function findReferenceUsages(lines) {
|
|
62
|
+
const usedLabels = [];
|
|
63
|
+
// Reference link regex: [text][label] or [text][] (shortcut reference)
|
|
64
|
+
const refLinkRegex = /\[([^\]]+)\]\[([^\]]*)\]/g;
|
|
65
|
+
// Reference image regex: ![text][label] or ![text][] (shortcut reference)
|
|
66
|
+
const refImageRegex = /!\[([^\]]+)\]\[([^\]]*)\]/g;
|
|
67
|
+
for (const line of lines) {
|
|
68
|
+
// Find all reference links in this line
|
|
69
|
+
let match;
|
|
70
|
+
while ((match = refLinkRegex.exec(line)) !== null) {
|
|
71
|
+
const text = match[1];
|
|
72
|
+
const label = match[2] || text; // For shortcut references, label is the text
|
|
73
|
+
usedLabels.push(label.toLowerCase());
|
|
74
|
+
}
|
|
75
|
+
// Reset regex to search from the beginning of the line
|
|
76
|
+
refImageRegex.lastIndex = 0;
|
|
77
|
+
// Find all reference images in this line
|
|
78
|
+
while ((match = refImageRegex.exec(line)) !== null) {
|
|
79
|
+
const text = match[1];
|
|
80
|
+
const label = match[2] || text; // For shortcut references, label is the text
|
|
81
|
+
usedLabels.push(label.toLowerCase());
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return usedLabels;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Rule implementation for MD053
|
|
88
|
+
*/
|
|
89
|
+
export const rule = {
|
|
90
|
+
name,
|
|
91
|
+
description,
|
|
92
|
+
fix,
|
|
93
|
+
};
|
|
94
|
+
export default rule;
|
|
95
|
+
//# sourceMappingURL=md053.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"md053.js","sourceRoot":"","sources":["../../src/rules/md053.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC;AAC5B,MAAM,CAAC,MAAM,WAAW,GAAG,uDAAuD,CAAC;AAEnF;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,KAAe;IACjC,uEAAuE;IACvE,MAAM,EAAE,eAAe,EAAE,GAAG,+BAA+B,CAAC,KAAK,CAAC,CAAC;IAEnE,4BAA4B;IAC5B,MAAM,UAAU,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAE9C,qDAAqD;IACrD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,K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|
+
/**
|
|
3
|
+
* MD054: Link and image style
|
|
4
|
+
*
|
|
5
|
+
* This rule is triggered when the style of links or images is inconsistent.
|
|
6
|
+
* Our fix will standardize on inline links and images.
|
|
7
|
+
*/
|
|
8
|
+
export declare const name = "MD054";
|
|
9
|
+
export declare const description = "Link and image style";
|
|
10
|
+
/**
|
|
11
|
+
* Fix by converting reference links/images to inline links/images
|
|
12
|
+
* @param lines Array of string lines to fix
|
|
13
|
+
* @returns Fixed lines array with standardized link style
|
|
14
|
+
*/
|
|
15
|
+
export declare function fix(lines: string[]): string[];
|
|
16
|
+
/**
|
|
17
|
+
* Rule implementation for MD054
|
|
18
|
+
*/
|
|
19
|
+
export declare const rule: Rule;
|
|
20
|
+
export default rule;
|
|
21
|
+
//# sourceMappingURL=md054.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"md054.d.ts","sourceRoot":"","sources":["../../src/rules/md054.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC;;;;;GAKG;AACH,eAAO,MAAM,IAAI,UAAU,CAAC;AAC5B,eAAO,MAAM,WAAW,yBAAyB,CAAC;AAElD;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAsD7C;AA0BD;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,IAIlB,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MD054: Link and image style
|
|
3
|
+
*
|
|
4
|
+
* This rule is triggered when the style of links or images is inconsistent.
|
|
5
|
+
* Our fix will standardize on inline links and images.
|
|
6
|
+
*/
|
|
7
|
+
export const name = 'MD054';
|
|
8
|
+
export const description = 'Link and image style';
|
|
9
|
+
/**
|
|
10
|
+
* Fix by converting reference links/images to inline links/images
|
|
11
|
+
* @param lines Array of string lines to fix
|
|
12
|
+
* @returns Fixed lines array with standardized link style
|
|
13
|
+
*/
|
|
14
|
+
export function fix(lines) {
|
|
15
|
+
// First, extract all reference link definitions
|
|
16
|
+
const definitions = extractReferenceLinkDefinitions(lines);
|
|
17
|
+
// Convert reference links/images to inline links/images
|
|
18
|
+
const updatedLines = lines.map(line => {
|
|
19
|
+
// Handle reference links: [text][label] or [text][]
|
|
20
|
+
let updatedLine = line.replace(/\[([^\]]+)\]\[([^\]]*)\]/g, (match, text, label) => {
|
|
21
|
+
// For shortcut reference links [text][], the label is the text
|
|
22
|
+
const actualLabel = label || text;
|
|
23
|
+
const labelKey = actualLabel.toLowerCase();
|
|
24
|
+
// Check if the label is defined
|
|
25
|
+
if (definitions[labelKey]) {
|
|
26
|
+
// Convert to inline link
|
|
27
|
+
return `[${text}](${definitions[labelKey]})`;
|
|
28
|
+
}
|
|
29
|
+
// If label is not defined, leave as is (MD052 will handle this)
|
|
30
|
+
return match;
|
|
31
|
+
});
|
|
32
|
+
// Handle reference images: ![text][label] or ![text][]
|
|
33
|
+
updatedLine = updatedLine.replace(/!\[([^\]]+)\]\[([^\]]*)\]/g, (match, text, label) => {
|
|
34
|
+
// For shortcut reference images ![text][], the label is the text
|
|
35
|
+
const actualLabel = label || text;
|
|
36
|
+
const labelKey = actualLabel.toLowerCase();
|
|
37
|
+
// Check if the label is defined
|
|
38
|
+
if (definitions[labelKey]) {
|
|
39
|
+
// Convert to inline image
|
|
40
|
+
return ``;
|
|
41
|
+
}
|
|
42
|
+
// If label is not defined, leave as is (MD052 will handle this)
|
|
43
|
+
return match;
|
|
44
|
+
});
|
|
45
|
+
return updatedLine;
|
|
46
|
+
});
|
|
47
|
+
// Finally, remove reference definitions since they're now inline
|
|
48
|
+
const usedDefinitionLines = new Set();
|
|
49
|
+
// Find lines that contain reference definitions
|
|
50
|
+
for (let i = 0; i < lines.length; i++) {
|
|
51
|
+
const definitionMatch = lines[i].match(/^\s*\[([^\]]+)\]:/);
|
|
52
|
+
if (definitionMatch) {
|
|
53
|
+
usedDefinitionLines.add(i);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Filter out reference definition lines
|
|
57
|
+
return updatedLines.filter((_, index) => !usedDefinitionLines.has(index));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Extract reference link definitions from the document
|
|
61
|
+
* Returns a map of lowercase labels to their URLs
|
|
62
|
+
*/
|
|
63
|
+
function extractReferenceLinkDefinitions(lines) {
|
|
64
|
+
const definitions = {};
|
|
65
|
+
// Regular expression to match reference link definitions: [label]: url
|
|
66
|
+
const definitionRegex = /^\s*\[([^\]]+)\]:\s*(\S+)(?:\s+(?:"([^"]+)"|'([^']+)'|\(([^)]+)\)))?$/;
|
|
67
|
+
for (const line of lines) {
|
|
68
|
+
const match = line.match(definitionRegex);
|
|
69
|
+
if (match) {
|
|
70
|
+
const label = match[1].trim();
|
|
71
|
+
const url = match[2];
|
|
72
|
+
// Store the definition (case-insensitive)
|
|
73
|
+
definitions[label.toLowerCase()] = url;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return definitions;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Rule implementation for MD054
|
|
80
|
+
*/
|
|
81
|
+
export const rule = {
|
|
82
|
+
name,
|
|
83
|
+
description,
|
|
84
|
+
fix,
|
|
85
|
+
};
|
|
86
|
+
export default rule;
|
|
87
|
+
//# sourceMappingURL=md054.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"md054.js","sourceRoot":"","sources":["../../src/rules/md054.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC;AAC5B,MAAM,CAAC,MAAM,WAAW,GAAG,sBAAsB,CAAC;AAElD;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,KAAe;IACjC,gDAAgD;IAChD,MAAM,WAAW,GAAG,+BAA+B,CAAC,KAAK,CAAC,CAAC;IAE3D,wDAAwD;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MAAM,eAAe,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC5D,IAAI,eAAe,EAAE,CAAC;YACpB,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,wCAAwC;IACxC,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED;;;GAGG;AACH,SAAS,+BAA+B,CAAC,KAAe;IACtD,MAAM,WAAW,GAA2B,EAAE,CAAC;IAE/C,uEAAuE;IACvE,MAAM,eAAe,GAAG,uEAAuE,CAAC;IAEhG,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAC1C,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAC9B,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YAErB,0CAA0C;YAC1C,WAAW,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,GAAG,GAAG,CAAC;QACzC,CAAC;IACH,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,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
|
+
* MD055: Table pipe style
|
|
4
|
+
*
|
|
5
|
+
* This rule enforces consistent style for pipe characters in tables.
|
|
6
|
+
* Table pipes can be aligned with spaces, surrounded by spaces,
|
|
7
|
+
* or neither, but the style should be consistent throughout the document.
|
|
8
|
+
*/
|
|
9
|
+
export declare const name = "MD055";
|
|
10
|
+
export declare const description = "Table pipe style";
|
|
11
|
+
/**
|
|
12
|
+
* Fix table pipe style by ensuring a consistent style throughout the document
|
|
13
|
+
* @param lines Array of string lines to fix
|
|
14
|
+
* @returns Fixed lines array with consistent table pipe style
|
|
15
|
+
*/
|
|
16
|
+
export declare function fix(lines: string[]): string[];
|
|
17
|
+
/**
|
|
18
|
+
* Rule implementation for MD055
|
|
19
|
+
*/
|
|
20
|
+
export declare const rule: Rule;
|
|
21
|
+
export default rule;
|
|
22
|
+
//# sourceMappingURL=md055.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"md055.d.ts","sourceRoot":"","sources":["../../src/rules/md055.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,UAAU,CAAC;AAC5B,eAAO,MAAM,WAAW,qBAAqB,CAAC;AA6C9C;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CA+G7C;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,IAIlB,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MD055: Table pipe style
|
|
3
|
+
*
|
|
4
|
+
* This rule enforces consistent style for pipe characters in tables.
|
|
5
|
+
* Table pipes can be aligned with spaces, surrounded by spaces,
|
|
6
|
+
* or neither, but the style should be consistent throughout the document.
|
|
7
|
+
*/
|
|
8
|
+
export const name = 'MD055';
|
|
9
|
+
export const description = 'Table pipe style';
|
|
10
|
+
/**
|
|
11
|
+
* Check if a line appears to be part of a table
|
|
12
|
+
* @param line The line to check
|
|
13
|
+
* @returns True if the line looks like a table row
|
|
14
|
+
*/
|
|
15
|
+
function isTableLine(line) {
|
|
16
|
+
// Tables must have at least one pipe character
|
|
17
|
+
// And generally start and end with a pipe
|
|
18
|
+
return line.trim().includes('|');
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Determine the pipe style from a table line
|
|
22
|
+
* @param line The table line to check
|
|
23
|
+
* @returns The pipe style ('surrounded', 'left', 'right', or 'none')
|
|
24
|
+
*/
|
|
25
|
+
function determinePipeStyle(line) {
|
|
26
|
+
// Skip separator lines (those with only dashes, pipes, and colons)
|
|
27
|
+
if (/^[\s|:\-]+$/.test(line)) {
|
|
28
|
+
return '';
|
|
29
|
+
}
|
|
30
|
+
const trimmed = line.trim();
|
|
31
|
+
// Check if the line has surrounding pipes (starts and ends with pipe)
|
|
32
|
+
const hasSurroundingPipes = trimmed.startsWith('|') && trimmed.endsWith('|');
|
|
33
|
+
// Check if pipes have spaces on both sides
|
|
34
|
+
const pipeWithSpaces = / \| /.test(trimmed);
|
|
35
|
+
const pipeWithLeftSpace = / \|/.test(trimmed);
|
|
36
|
+
const pipeWithRightSpace = /\| /.test(trimmed);
|
|
37
|
+
if (hasSurroundingPipes && pipeWithSpaces) {
|
|
38
|
+
return 'surrounded';
|
|
39
|
+
}
|
|
40
|
+
else if (hasSurroundingPipes && pipeWithLeftSpace) {
|
|
41
|
+
return 'left';
|
|
42
|
+
}
|
|
43
|
+
else if (hasSurroundingPipes && pipeWithRightSpace) {
|
|
44
|
+
return 'right';
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
return 'none';
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Fix table pipe style by ensuring a consistent style throughout the document
|
|
52
|
+
* @param lines Array of string lines to fix
|
|
53
|
+
* @returns Fixed lines array with consistent table pipe style
|
|
54
|
+
*/
|
|
55
|
+
export function fix(lines) {
|
|
56
|
+
if (lines.length === 0)
|
|
57
|
+
return lines;
|
|
58
|
+
// Find all table lines
|
|
59
|
+
const tableLines = [];
|
|
60
|
+
for (let i = 0; i < lines.length; i++) {
|
|
61
|
+
if (isTableLine(lines[i])) {
|
|
62
|
+
tableLines.push(i);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (tableLines.length === 0) {
|
|
66
|
+
return lines; // No tables found
|
|
67
|
+
}
|
|
68
|
+
// Determine the preferred pipe style
|
|
69
|
+
let styleCount = {
|
|
70
|
+
surrounded: 0,
|
|
71
|
+
left: 0,
|
|
72
|
+
right: 0,
|
|
73
|
+
none: 0,
|
|
74
|
+
};
|
|
75
|
+
for (const lineIndex of tableLines) {
|
|
76
|
+
const style = determinePipeStyle(lines[lineIndex]);
|
|
77
|
+
if (style) {
|
|
78
|
+
styleCount[style]++;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Find the most common style
|
|
82
|
+
let preferredStyle = 'surrounded'; // Default to surrounded
|
|
83
|
+
let maxCount = 0;
|
|
84
|
+
for (const [style, count] of Object.entries(styleCount)) {
|
|
85
|
+
if (count > maxCount) {
|
|
86
|
+
maxCount = count;
|
|
87
|
+
preferredStyle = style;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// Now fix all table lines to match the preferred style
|
|
91
|
+
const result = [...lines];
|
|
92
|
+
for (const lineIndex of tableLines) {
|
|
93
|
+
const line = lines[lineIndex];
|
|
94
|
+
// Skip separator lines (those with only dashes, pipes, and colons)
|
|
95
|
+
if (/^[\s|:\-]+$/.test(line.trim())) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
const currentStyle = determinePipeStyle(line);
|
|
99
|
+
if (!currentStyle || currentStyle === preferredStyle) {
|
|
100
|
+
continue; // Skip separator lines or lines already in the preferred style
|
|
101
|
+
}
|
|
102
|
+
const trimmed = line.trim();
|
|
103
|
+
const indentation = line.slice(0, line.indexOf(trimmed));
|
|
104
|
+
// Split the line by pipes
|
|
105
|
+
let parts = trimmed.split('|');
|
|
106
|
+
// Handle surrounding pipes
|
|
107
|
+
let startWithPipe = trimmed.startsWith('|');
|
|
108
|
+
let endWithPipe = trimmed.endsWith('|');
|
|
109
|
+
// If the line doesn't start with a pipe, the first part is content
|
|
110
|
+
if (!startWithPipe) {
|
|
111
|
+
parts.unshift('');
|
|
112
|
+
}
|
|
113
|
+
// If the line doesn't end with a pipe, the last part is content
|
|
114
|
+
if (!endWithPipe) {
|
|
115
|
+
parts.push('');
|
|
116
|
+
}
|
|
117
|
+
// Remove empty parts at the beginning and end if they exist
|
|
118
|
+
if (parts[0] === '') {
|
|
119
|
+
parts.shift();
|
|
120
|
+
}
|
|
121
|
+
if (parts[parts.length - 1] === '') {
|
|
122
|
+
parts.pop();
|
|
123
|
+
}
|
|
124
|
+
// Now adjust according to preferred style
|
|
125
|
+
let newLine = '';
|
|
126
|
+
switch (preferredStyle) {
|
|
127
|
+
case 'surrounded':
|
|
128
|
+
// Ensure spaces around pipes and pipes at start and end
|
|
129
|
+
newLine = '| ' + parts.map(p => p.trim()).join(' | ') + ' |';
|
|
130
|
+
break;
|
|
131
|
+
case 'left':
|
|
132
|
+
// Ensure spaces before pipes
|
|
133
|
+
newLine = '|' + parts.map(p => ' ' + p.trim()).join('|') + '|';
|
|
134
|
+
break;
|
|
135
|
+
case 'right':
|
|
136
|
+
// Ensure spaces after pipes
|
|
137
|
+
newLine = '|' + parts.map(p => p.trim() + ' ').join('|') + '|';
|
|
138
|
+
break;
|
|
139
|
+
case 'none':
|
|
140
|
+
// No spaces around pipes
|
|
141
|
+
newLine = '|' + parts.map(p => p.trim()).join('|') + '|';
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
result[lineIndex] = indentation + newLine;
|
|
145
|
+
}
|
|
146
|
+
return result;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Rule implementation for MD055
|
|
150
|
+
*/
|
|
151
|
+
export const rule = {
|
|
152
|
+
name,
|
|
153
|
+
description,
|
|
154
|
+
fix,
|
|
155
|
+
};
|
|
156
|
+
export default rule;
|
|
157
|
+
//# sourceMappingURL=md055.js.map
|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