-
Notifications
You must be signed in to change notification settings - Fork 66.5k
Expand file tree
/
Copy pathmarkdownlint-rule-helpers.d.ts
More file actions
40 lines (36 loc) · 1.39 KB
/
markdownlint-rule-helpers.d.ts
File metadata and controls
40 lines (36 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
declare module 'markdownlint-rule-helpers' {
/**
* Adds an error to the linting results
* Using any because this third-party library doesn't provide TypeScript definitions
* onError is a callback function with dynamic signature from markdownlint
* fixInfo contains various fix information structures depending on the error type
*/
export function addError(
onError: any,
lineNumber: number,
detail?: string,
context?: string | null,
range?: [number, number] | number[] | string | null,
fixInfo?: any,
): void
/**
* Filters tokens by type and calls a handler for each matching token
* Using any because markdownlint-rule-helpers has no TypeScript definitions
* params contains markdownlint parsing parameters with varying structures
* token represents markdown tokens with different properties per token type
*/
export function filterTokens(params: any, type: string, handler: (token: any) => void): void
/**
* Truncates long strings with ellipsis for display
*/
export function ellipsify(text: string, length?: number, preferEnd?: boolean): string
/**
* Regular expression for newline characters
*/
export const newLineRe: RegExp
/**
* Applies fixes to markdown content
* Using any[] because error objects from markdownlint have dynamic structures
*/
export function applyFixes(content: string, errors: any[]): string
}