@markuplint/ml-core 3.0.0-alpha.4 → 3.0.0-alpha.6
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/lib/configs.js +5 -1
- package/lib/index.d.ts +11 -1
- package/lib/ml-core.d.ts +23 -12
- package/lib/ml-dom/helper/create-node.d.ts +4 -1
- package/lib/ml-dom/helper/getIndent.d.ts +7 -7
- package/lib/ml-dom/helper/walkers.d.ts +12 -4
- package/lib/ml-dom/index.d.ts +1 -0
- package/lib/ml-dom/manipulations/child-node-methods.d.ts +18 -5
- package/lib/ml-dom/manipulations/get-children.d.ts +3 -1
- package/lib/ml-dom/node/attr.d.ts +89 -89
- package/lib/ml-dom/node/block.d.ts +30 -30
- package/lib/ml-dom/node/character-data.d.ts +59 -52
- package/lib/ml-dom/node/child-node.d.ts +6 -1
- package/lib/ml-dom/node/comment.d.ts +15 -12
- package/lib/ml-dom/node/document-fragment.d.ts +22 -19
- package/lib/ml-dom/node/document-type.d.ts +34 -31
- package/lib/ml-dom/node/document.d.ts +1596 -1562
- package/lib/ml-dom/node/document.js +31 -0
- package/lib/ml-dom/node/dom-token-list.d.ts +27 -27
- package/lib/ml-dom/node/element.d.ts +1894 -1840
- package/lib/ml-dom/node/element.js +60 -0
- package/lib/ml-dom/node/named-node-map.d.ts +44 -39
- package/lib/ml-dom/node/node-list.d.ts +9 -3
- package/lib/ml-dom/node/node-store.d.ts +3 -3
- package/lib/ml-dom/node/node.d.ts +491 -471
- package/lib/ml-dom/node/node.js +3 -3
- package/lib/ml-dom/node/parent-node.d.ts +66 -57
- package/lib/ml-dom/node/rule-mapper.d.ts +9 -9
- package/lib/ml-dom/node/text.d.ts +49 -46
- package/lib/ml-dom/node/types.d.ts +78 -22
- package/lib/ml-dom/node/unexpected-call-error.d.ts +1 -2
- package/lib/ml-dom/token/token.d.ts +44 -44
- package/lib/ml-rule/create-test-rule.d.ts +5 -3
- package/lib/ml-rule/ml-rule-context.d.ts +55 -47
- package/lib/ml-rule/ml-rule.d.ts +25 -23
- package/lib/ml-rule/types.d.ts +21 -15
- package/lib/plugin/types.d.ts +8 -8
- package/lib/ruleset/index.d.ts +4 -4
- package/lib/test/index.d.ts +20 -8
- package/lib/types.d.ts +9 -9
- package/lib/utils/get-location-from-chars.d.ts +9 -4
- package/package.json +10 -10
- package/tsconfig.tsbuildinfo +1 -1
package/lib/ml-dom/node/node.js
CHANGED
|
@@ -336,7 +336,7 @@ class MLNode extends token_1.MLToken {
|
|
|
336
336
|
* @see https://dom.spec.whatwg.org/#ref-for-dom-node-parentnode%E2%91%A0
|
|
337
337
|
*/
|
|
338
338
|
get parentNode() {
|
|
339
|
-
const parentNode = this.
|
|
339
|
+
const parentNode = this.syntacticalParentNode;
|
|
340
340
|
if (!parentNode) {
|
|
341
341
|
return null;
|
|
342
342
|
}
|
|
@@ -413,7 +413,7 @@ class MLNode extends token_1.MLToken {
|
|
|
413
413
|
return this.ownerMLDocument.currentRule.optimizeOption(rule);
|
|
414
414
|
}
|
|
415
415
|
/**
|
|
416
|
-
* Returns a
|
|
416
|
+
* Returns a syntactical parent node
|
|
417
417
|
*
|
|
418
418
|
* ## HTML:
|
|
419
419
|
*
|
|
@@ -450,7 +450,7 @@ class MLNode extends token_1.MLToken {
|
|
|
450
450
|
*
|
|
451
451
|
* @implements `@markuplint/ml-core` API: `MLNode`
|
|
452
452
|
*/
|
|
453
|
-
get
|
|
453
|
+
get syntacticalParentNode() {
|
|
454
454
|
if (!this._astToken.parentNode) {
|
|
455
455
|
return this.ownerMLDocument;
|
|
456
456
|
}
|
|
@@ -6,61 +6,70 @@ import { MLNode } from './node';
|
|
|
6
6
|
*
|
|
7
7
|
* @see https://dom.spec.whatwg.org/#interface-parentnode
|
|
8
8
|
*/
|
|
9
|
-
export declare abstract class MLParentNode<
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
9
|
+
export declare abstract class MLParentNode<
|
|
10
|
+
T extends RuleConfigValue,
|
|
11
|
+
O = null,
|
|
12
|
+
A extends MLASTAbstractNode = MLASTAbstractNode,
|
|
13
|
+
>
|
|
14
|
+
extends MLNode<T, O, A>
|
|
15
|
+
implements ParentNode
|
|
16
|
+
{
|
|
17
|
+
#private;
|
|
18
|
+
/**
|
|
19
|
+
* @implements DOM API: `Element`, `Document`, `DocumentFragment`
|
|
20
|
+
* @see https://dom.spec.whatwg.org/#dom-parentnode-childelementcount
|
|
21
|
+
*/
|
|
22
|
+
get childElementCount(): number;
|
|
23
|
+
/**
|
|
24
|
+
* @implements DOM API: `Element`, `Document`, `DocumentFragment`
|
|
25
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-children%E2%91%A0
|
|
26
|
+
*/
|
|
27
|
+
get children(): HTMLCollectionOf<MLElement<T, O>>;
|
|
28
|
+
/**
|
|
29
|
+
* @implements DOM API: `Element`, `Document`, `DocumentFragment`
|
|
30
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-firstelementchild%E2%91%A0
|
|
31
|
+
*/
|
|
32
|
+
get firstElementChild(): MLElement<T, O>;
|
|
33
|
+
/**
|
|
34
|
+
* @implements DOM API: `Element`, `Document`, `DocumentFragment`
|
|
35
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-lastelementchild%E2%91%A0
|
|
36
|
+
*/
|
|
37
|
+
get lastElementChild(): MLElement<T, O>;
|
|
38
|
+
/**
|
|
39
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
40
|
+
*
|
|
41
|
+
* @unsupported
|
|
42
|
+
* @implements DOM API: `Element`, `Document`, `DocumentFragment`
|
|
43
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-append%E2%91%A0
|
|
44
|
+
*/
|
|
45
|
+
append(...nodes: (string | Node)[]): void;
|
|
46
|
+
/**
|
|
47
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
48
|
+
*
|
|
49
|
+
* @unsupported
|
|
50
|
+
* @implements DOM API: `Element`, `Document`, `DocumentFragment`
|
|
51
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-prepend%E2%91%A0
|
|
52
|
+
*/
|
|
53
|
+
prepend(...nodes: (string | Node)[]): void;
|
|
54
|
+
/**
|
|
55
|
+
* @implements DOM API: `Element`, `Document`, `DocumentFragment`
|
|
56
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-queryselector%E2%91%A0
|
|
57
|
+
*/
|
|
58
|
+
querySelector(selectors: string): MLElement<T, O> | null;
|
|
59
|
+
/**
|
|
60
|
+
* @implements DOM API: `Element`, `Document`, `DocumentFragment`
|
|
61
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-queryselectorall%E2%91%A0
|
|
62
|
+
*/
|
|
63
|
+
querySelectorAll(selectors: string): NodeListOf<MLElement<T, O>>;
|
|
64
|
+
/**
|
|
65
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
66
|
+
*
|
|
67
|
+
* @unsupported
|
|
68
|
+
* @implements DOM API: `Element`, `Document`, `DocumentFragment`
|
|
69
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-replacechildren%E2%91%A0
|
|
70
|
+
*/
|
|
71
|
+
replaceChildren(...nodes: (string | Node)[]): void;
|
|
72
|
+
protected _descendantsToArray<N extends MLNode<T, O>>(
|
|
73
|
+
filter?: (node: MLNode<T, O>) => N | null | void,
|
|
74
|
+
): ReadonlyArray<N>;
|
|
66
75
|
}
|
|
@@ -2,16 +2,16 @@ import type { MLDocument } from './document';
|
|
|
2
2
|
import type { MLNode } from './node';
|
|
3
3
|
import type { AnyRule } from '@markuplint/ml-config';
|
|
4
4
|
import type { Specificity } from '@markuplint/selector';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
type RuleType = 'rules' | 'nodeRules' | 'childNodeRules';
|
|
6
|
+
type MappingLayer = {
|
|
7
|
+
from: RuleType;
|
|
8
|
+
specificity: Specificity;
|
|
9
|
+
rule: AnyRule;
|
|
10
10
|
};
|
|
11
11
|
export declare class RuleMapper {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
#private;
|
|
13
|
+
constructor(document: MLDocument<any, any>);
|
|
14
|
+
apply(): void;
|
|
15
|
+
set(node: MLNode<any, any>, ruleName: string, rule: MappingLayer): void;
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
@@ -2,50 +2,53 @@ import type { TextNodeType } from './types';
|
|
|
2
2
|
import type { MLASTText } from '@markuplint/ml-ast';
|
|
3
3
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
4
4
|
import { MLCharacterData } from './character-data';
|
|
5
|
-
export declare class MLText<T extends RuleConfigValue, O = null>
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
5
|
+
export declare class MLText<T extends RuleConfigValue, O = null>
|
|
6
|
+
extends MLCharacterData<T, O, MLASTText>
|
|
7
|
+
implements Text
|
|
8
|
+
{
|
|
9
|
+
/**
|
|
10
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
11
|
+
*
|
|
12
|
+
* @unsupported
|
|
13
|
+
* @implements DOM API: `Text`
|
|
14
|
+
*/
|
|
15
|
+
get assignedSlot(): HTMLSlotElement;
|
|
16
|
+
/**
|
|
17
|
+
* Returns a string appropriate for the type of node as `Text`
|
|
18
|
+
*
|
|
19
|
+
* @see https://dom.spec.whatwg.org/#ref-for-attr%E2%91%A4
|
|
20
|
+
*/
|
|
21
|
+
get nodeName(): '#text';
|
|
22
|
+
/**
|
|
23
|
+
* Returns a number appropriate for the type of `Text`
|
|
24
|
+
*/
|
|
25
|
+
get nodeType(): TextNodeType;
|
|
26
|
+
get textContent(): string | null;
|
|
27
|
+
/**
|
|
28
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
29
|
+
*
|
|
30
|
+
* @unsupported
|
|
31
|
+
* @implements DOM API: `Text`
|
|
32
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-text-splittext%E2%91%A0
|
|
33
|
+
*/
|
|
34
|
+
get wholeText(): string;
|
|
35
|
+
/**
|
|
36
|
+
* Returns `true` if a parent element is `<script>` or `<style>`
|
|
37
|
+
*
|
|
38
|
+
* @implements `@markuplint/ml-core` API: `MLText`
|
|
39
|
+
* @see https://html.spec.whatwg.org/multipage/syntax.html#raw-text-elements
|
|
40
|
+
*/
|
|
41
|
+
isRawTextElementContent(): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* @implements `@markuplint/ml-core` API: `MLText`
|
|
44
|
+
*/
|
|
45
|
+
isWhitespace(): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
48
|
+
*
|
|
49
|
+
* @unsupported
|
|
50
|
+
* @implements DOM API: `Text`
|
|
51
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-text-wholetext%E2%91%A0
|
|
52
|
+
*/
|
|
53
|
+
splitText(offset: number): Text;
|
|
51
54
|
}
|
|
@@ -8,28 +8,84 @@ import type { MLDocumentType } from './document-type';
|
|
|
8
8
|
import type { MLElement } from './element';
|
|
9
9
|
import type { MLNode } from './node';
|
|
10
10
|
import type { MLText } from './text';
|
|
11
|
-
import type {
|
|
11
|
+
import type {
|
|
12
|
+
MLASTAbstractNode,
|
|
13
|
+
MLASTAttr,
|
|
14
|
+
MLASTComment,
|
|
15
|
+
MLASTDoctype,
|
|
16
|
+
MLASTElement,
|
|
17
|
+
MLASTParentNode,
|
|
18
|
+
MLASTPreprocessorSpecificBlock,
|
|
19
|
+
MLASTText,
|
|
20
|
+
MLToken as MLASTToken,
|
|
21
|
+
} from '@markuplint/ml-ast/';
|
|
12
22
|
import type { PretenderARIA, RuleConfigValue } from '@markuplint/ml-config';
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
export type MappedNode<N, T extends RuleConfigValue, O = null> = N extends MLASTElement
|
|
24
|
+
? MLElement<T, O>
|
|
25
|
+
: N extends MLASTParentNode
|
|
26
|
+
? MLElement<T, O>
|
|
27
|
+
: N extends MLASTComment
|
|
28
|
+
? MLComment<T, O>
|
|
29
|
+
: N extends MLASTText
|
|
30
|
+
? MLText<T, O>
|
|
31
|
+
: N extends MLASTDoctype
|
|
32
|
+
? MLDocumentType<T, O>
|
|
33
|
+
: N extends MLASTPreprocessorSpecificBlock
|
|
34
|
+
? MLBlock<T, O>
|
|
35
|
+
: N extends MLASTAbstractNode
|
|
36
|
+
? MLNode<T, O, MLASTAbstractNode>
|
|
37
|
+
: N extends MLASTAttr
|
|
38
|
+
? MLAttr<T, O>
|
|
39
|
+
: N extends MLASTToken
|
|
40
|
+
? MLToken
|
|
41
|
+
: never;
|
|
42
|
+
export type NodeTypeOf<NT extends NodeType, T extends RuleConfigValue, O = null> = NT extends ElementNodeType
|
|
43
|
+
? MLElement<T, O>
|
|
44
|
+
: NT extends CommentNodeType
|
|
45
|
+
? MLComment<T, O>
|
|
46
|
+
: NT extends TextNodeType
|
|
47
|
+
? MLText<T, O>
|
|
48
|
+
: NT extends DocumentNodeType
|
|
49
|
+
? MLDocument<T, O>
|
|
50
|
+
: NT extends DocumentTypeNodeType
|
|
51
|
+
? MLDocumentType<T, O>
|
|
52
|
+
: NT extends DocumentFragmentNodeType
|
|
53
|
+
? MLDocumentFragment<T, O>
|
|
54
|
+
: NT extends MarkuplintPreprocessorBlockType
|
|
55
|
+
? MLBlock<T, O>
|
|
56
|
+
: NT extends AttributeNodeType
|
|
57
|
+
? MLAttr<T, O>
|
|
58
|
+
: never;
|
|
59
|
+
export type ElementNodeType = 1;
|
|
60
|
+
export type AttributeNodeType = 2;
|
|
61
|
+
export type TextNodeType = 3;
|
|
62
|
+
export type CDATASectionNodeType = 4;
|
|
63
|
+
export type ProcessingInstructionNodeType = 7;
|
|
64
|
+
export type CommentNodeType = 8;
|
|
65
|
+
export type DocumentNodeType = 9;
|
|
66
|
+
export type DocumentTypeNodeType = 10;
|
|
67
|
+
export type DocumentFragmentNodeType = 11;
|
|
68
|
+
export type MarkuplintPreprocessorBlockType = 101;
|
|
69
|
+
export type NodeType =
|
|
70
|
+
| ElementNodeType
|
|
71
|
+
| AttributeNodeType
|
|
72
|
+
| TextNodeType
|
|
73
|
+
| CDATASectionNodeType
|
|
74
|
+
| ProcessingInstructionNodeType
|
|
75
|
+
| CommentNodeType
|
|
76
|
+
| DocumentNodeType
|
|
77
|
+
| DocumentTypeNodeType
|
|
78
|
+
| DocumentFragmentNodeType
|
|
79
|
+
| MarkuplintPreprocessorBlockType;
|
|
80
|
+
export type PretenderContext<N extends MLElement<T, O>, T extends RuleConfigValue, O = null> =
|
|
81
|
+
| PretenderContextPretender<N, T, O>
|
|
82
|
+
| PretenderContextPretended<N, T, O>;
|
|
83
|
+
export type PretenderContextPretender<N extends MLElement<T, O>, T extends RuleConfigValue, O = null> = {
|
|
84
|
+
readonly type: 'pretender';
|
|
85
|
+
readonly as: N;
|
|
86
|
+
readonly aria?: PretenderARIA;
|
|
31
87
|
};
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
|
|
88
|
+
export type PretenderContextPretended<N extends MLElement<T, O>, T extends RuleConfigValue, O = null> = {
|
|
89
|
+
readonly type: 'origin';
|
|
90
|
+
readonly origin: N;
|
|
35
91
|
};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export default class UnexpectedCallError extends Error {
|
|
2
|
-
}
|
|
1
|
+
export default class UnexpectedCallError extends Error {}
|
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
import type { MLToken as MLASTToken } from '@markuplint/ml-ast';
|
|
2
2
|
export declare class MLToken<A extends MLASTToken = MLASTToken> {
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
3
|
+
#private;
|
|
4
|
+
readonly uuid: string;
|
|
5
|
+
protected readonly _astToken: A;
|
|
6
|
+
constructor(astToken: A);
|
|
7
|
+
/**
|
|
8
|
+
* @implements `@markuplint/ml-core` API: `MLDOMToken`
|
|
9
|
+
*/
|
|
10
|
+
get endCol(): number;
|
|
11
|
+
/**
|
|
12
|
+
* @implements `@markuplint/ml-core` API: `MLDOMToken`
|
|
13
|
+
*/
|
|
14
|
+
get endLine(): number;
|
|
15
|
+
/**
|
|
16
|
+
* @implements `@markuplint/ml-core` API: `MLDOMToken`
|
|
17
|
+
*/
|
|
18
|
+
get endOffset(): number;
|
|
19
|
+
/**
|
|
20
|
+
* @implements `@markuplint/ml-core` API: `MLDOMToken`
|
|
21
|
+
*/
|
|
22
|
+
get originRaw(): string;
|
|
23
|
+
/**
|
|
24
|
+
* @implements `@markuplint/ml-core` API: `MLDOMToken`
|
|
25
|
+
*/
|
|
26
|
+
get raw(): string;
|
|
27
|
+
/**
|
|
28
|
+
* @implements `@markuplint/ml-core` API: `MLDOMToken`
|
|
29
|
+
*/
|
|
30
|
+
get startCol(): number;
|
|
31
|
+
/**
|
|
32
|
+
* @implements `@markuplint/ml-core` API: `MLDOMToken`
|
|
33
|
+
*/
|
|
34
|
+
get startLine(): number;
|
|
35
|
+
/**
|
|
36
|
+
* @implements `@markuplint/ml-core` API: `MLDOMToken`
|
|
37
|
+
*/
|
|
38
|
+
get startOffset(): number;
|
|
39
|
+
/**
|
|
40
|
+
* @implements `@markuplint/ml-core` API: `MLDOMToken`
|
|
41
|
+
*/
|
|
42
|
+
fix(raw: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* @implements `@markuplint/ml-core` API: `MLDOMToken`
|
|
45
|
+
*/
|
|
46
|
+
toString(): string;
|
|
47
47
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { RuleSeed } from './types';
|
|
2
2
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
3
3
|
import { MLRule } from './ml-rule';
|
|
4
|
-
export declare function createRule<T extends RuleConfigValue, O = null>(
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export declare function createRule<T extends RuleConfigValue, O = null>(
|
|
5
|
+
seed: RuleSeed<T, O> & {
|
|
6
|
+
name: string;
|
|
7
|
+
},
|
|
8
|
+
): MLRule<T, O>;
|
|
@@ -3,51 +3,59 @@ import type { CheckerReport } from './types';
|
|
|
3
3
|
import type { LocaleSet, Translator } from '@markuplint/i18n';
|
|
4
4
|
import type { Report, RuleConfigValue } from '@markuplint/ml-config';
|
|
5
5
|
export declare class MLRuleContext<T extends RuleConfigValue, O = null> {
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
6
|
+
#private;
|
|
7
|
+
readonly document: MLDocument<T, O>;
|
|
8
|
+
readonly locale: string;
|
|
9
|
+
readonly translate: Translator;
|
|
10
|
+
constructor(document: MLDocument<T, O>, locale: LocaleSet);
|
|
11
|
+
get reports(): (
|
|
12
|
+
| {
|
|
13
|
+
message: string;
|
|
14
|
+
line: number;
|
|
15
|
+
col: number;
|
|
16
|
+
raw: string;
|
|
17
|
+
}
|
|
18
|
+
| {
|
|
19
|
+
message: string;
|
|
20
|
+
scope: import('@markuplint/ml-config').Scope<T, O>;
|
|
21
|
+
}
|
|
22
|
+
| {
|
|
23
|
+
message: string;
|
|
24
|
+
scope: import('@markuplint/ml-config').Scope<T, O>;
|
|
25
|
+
line: number;
|
|
26
|
+
col: number;
|
|
27
|
+
raw: string;
|
|
28
|
+
}
|
|
29
|
+
)[];
|
|
30
|
+
provide(): {
|
|
31
|
+
document: MLDocument<T, O>;
|
|
32
|
+
translate: Translator;
|
|
33
|
+
t: Translator;
|
|
34
|
+
reports: (
|
|
35
|
+
| {
|
|
36
|
+
message: string;
|
|
37
|
+
line: number;
|
|
38
|
+
col: number;
|
|
39
|
+
raw: string;
|
|
40
|
+
}
|
|
41
|
+
| {
|
|
42
|
+
message: string;
|
|
43
|
+
scope: import('@markuplint/ml-config').Scope<T, O>;
|
|
44
|
+
}
|
|
45
|
+
| {
|
|
46
|
+
message: string;
|
|
47
|
+
scope: import('@markuplint/ml-config').Scope<T, O>;
|
|
48
|
+
line: number;
|
|
49
|
+
col: number;
|
|
50
|
+
raw: string;
|
|
51
|
+
}
|
|
52
|
+
)[];
|
|
53
|
+
report: {
|
|
54
|
+
(report: Report<T, O>): undefined;
|
|
55
|
+
(report: CheckerReport<T, O>): boolean;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
report(report: Report<T, O>): undefined;
|
|
59
|
+
report(report: CheckerReport<T, O>): boolean;
|
|
60
|
+
private _push;
|
|
53
61
|
}
|