@diplodoc/yfmlint 1.3.5 → 1.6.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/build/config.d.ts +1 -0
- package/build/index.js +190 -58
- package/build/index.js.map +4 -4
- package/build/rules/helpers.d.ts +38 -0
- package/build/rules/index.d.ts +1 -0
- package/build/rules/yfm018.d.ts +2 -0
- package/package.json +2 -2
package/build/rules/helpers.d.ts
CHANGED
|
@@ -1,16 +1,54 @@
|
|
|
1
1
|
import type { MarkdownItToken, RuleOnError, RuleParams } from 'markdownlint';
|
|
2
2
|
import type { TokenWithAttrs } from '../typings';
|
|
3
|
+
export interface IncludeChainEntry {
|
|
4
|
+
file: string;
|
|
5
|
+
line: number;
|
|
6
|
+
}
|
|
7
|
+
export interface IncludeSourceInfo {
|
|
8
|
+
lineNumber: number;
|
|
9
|
+
sourceFile: string;
|
|
10
|
+
sourceLineNumber: number;
|
|
11
|
+
includeChain: IncludeChainEntry[];
|
|
12
|
+
}
|
|
3
13
|
/**
|
|
4
14
|
* Validates and adjusts lineNumber to prevent markdownlint exception.
|
|
5
15
|
* When include files are used, lineNumber might exceed the original file's line count.
|
|
6
16
|
* Also returns the file path from markdown-it env if available.
|
|
17
|
+
*
|
|
18
|
+
* @param params - Rule parameters from markdownlint
|
|
19
|
+
* @param rawLineNumber - The raw line number to validate
|
|
20
|
+
* @returns Object containing validated line number and file path
|
|
7
21
|
*/
|
|
8
22
|
export declare function validateLineNumberAndGetFilePath(params: RuleParams, rawLineNumber: number | undefined): {
|
|
9
23
|
lineNumber: number;
|
|
10
24
|
filePath: string;
|
|
11
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Extracts include source metadata from token.meta (set by the includes plugin).
|
|
28
|
+
* Returns null if the token is not from included content.
|
|
29
|
+
*
|
|
30
|
+
* @param params - Rule parameters from markdownlint
|
|
31
|
+
* @param rawLineNumber - The raw line number from the token
|
|
32
|
+
* @param token - The token to check for include metadata
|
|
33
|
+
* @param parentToken - The parent token to check for include metadata
|
|
34
|
+
* @returns Include source information or null if not from included content
|
|
35
|
+
*/
|
|
36
|
+
export declare function resolveIncludeSource(params: RuleParams, rawLineNumber: number | undefined, token?: MarkdownItToken, parentToken?: MarkdownItToken): IncludeSourceInfo | null;
|
|
37
|
+
/**
|
|
38
|
+
* Formats include chain as: `main.md:3 → chapter.md:5 → details.md:10 ↛ broken.html`
|
|
39
|
+
*
|
|
40
|
+
* @param info - Include source information
|
|
41
|
+
* @param brokenTarget - The broken target (e.g., href or src)
|
|
42
|
+
* @returns Formatted include chain string
|
|
43
|
+
*/
|
|
44
|
+
export declare function formatIncludeChain(info: IncludeSourceInfo, brokenTarget: string): string;
|
|
12
45
|
/**
|
|
13
46
|
* Creates error context with optional file path information.
|
|
47
|
+
*
|
|
48
|
+
* @param baseContext - The base context string
|
|
49
|
+
* @param filePath - The file path to include if different from paramsName
|
|
50
|
+
* @param paramsName - The parameter name (original file path)
|
|
51
|
+
* @returns Formatted context string
|
|
14
52
|
*/
|
|
15
53
|
export declare function createContextWithFileInfo(baseContext: string, filePath: string, paramsName: string): string;
|
|
16
54
|
/**
|
package/build/rules/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diplodoc/yfmlint",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "YFM (Yandex Flavored Markdown) syntax linter with custom rules for Diplodoc platform",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"lint": "lint update && lint",
|
|
46
46
|
"lint:fix": "lint update && lint fix",
|
|
47
47
|
"pre-commit": "lint update && lint-staged",
|
|
48
|
-
"prepare": "husky"
|
|
48
|
+
"prepare": "husky || exit 0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@diplodoc/lint": "^1.13.2",
|