@markuplint/ml-core 2.0.0-rc.6 → 2.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/README.md +0 -15
- package/lib/ml-core.d.ts +11 -11
- package/lib/ml-dom/document.d.ts +66 -57
- package/lib/ml-dom/helper/create-node.d.ts +5 -1
- package/lib/ml-dom/helper/debug.d.ts +4 -1
- package/lib/ml-dom/helper/getIndent.d.ts +7 -7
- package/lib/ml-dom/helper/mapped-nodes.d.ts +51 -3
- package/lib/ml-dom/helper/match-selector.d.ts +10 -6
- package/lib/ml-dom/helper/node-store.d.ts +6 -3
- package/lib/ml-dom/helper/selector.d.ts +3 -3
- package/lib/ml-dom/helper/walkers.d.ts +7 -2
- package/lib/ml-dom/index.d.ts +10 -1
- package/lib/ml-dom/rule-mapper.d.ts +7 -7
- package/lib/ml-dom/tokens/abstract-element.d.ts +40 -36
- package/lib/ml-dom/tokens/attribute.d.ts +36 -36
- package/lib/ml-dom/tokens/comment.d.ts +5 -2
- package/lib/ml-dom/tokens/doctype.d.ts +10 -7
- package/lib/ml-dom/tokens/element-close-tag.d.ts +19 -16
- package/lib/ml-dom/tokens/element.d.ts +18 -15
- package/lib/ml-dom/tokens/node.d.ts +23 -16
- package/lib/ml-dom/tokens/omitted-element.d.ts +7 -4
- package/lib/ml-dom/tokens/preprocessor-specific-attribute.d.ts +20 -20
- package/lib/ml-dom/tokens/preprocessor-specific-block.d.ts +8 -5
- package/lib/ml-dom/tokens/text.d.ts +9 -6
- package/lib/ml-dom/tokens/token.d.ts +13 -13
- package/lib/ml-dom/types.d.ts +35 -13
- package/lib/ml-error/ml-parse-error.d.ts +5 -5
- package/lib/ml-rule/create-test-rule.d.ts +5 -3
- package/lib/ml-rule/ml-rule-context.d.ts +52 -44
- package/lib/ml-rule/ml-rule.d.ts +33 -23
- package/lib/ml-rule/types.d.ts +5 -5
- package/lib/plugin/types.d.ts +5 -5
- package/lib/ruleset/index.d.ts +4 -4
- package/lib/test/index.d.ts +14 -5
- package/lib/types.d.ts +6 -6
- package/lib/utils/get-location-from-chars.d.ts +9 -4
- package/package.json +10 -10
- package/tsconfig.tsbuildinfo +1 -1
package/README.md
CHANGED
|
@@ -6,23 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
|
-
Prerequisites: [Node.js](https://nodejs.org) (Version 12.4.0 or later)
|
|
10
|
-
|
|
11
9
|
```sh
|
|
12
10
|
$ npm install @markuplint/ml-core
|
|
13
11
|
|
|
14
12
|
$ yarn add @markuplint/ml-core
|
|
15
13
|
```
|
|
16
|
-
|
|
17
|
-
## Contributing
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
$ git clone git@github.com:markuplint/markuplint.git -b main
|
|
21
|
-
$ yarn
|
|
22
|
-
$ yarn build
|
|
23
|
-
$ yarn test
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
Copyright © 2021 markuplint. Under the MIT License.
|
package/lib/ml-core.d.ts
CHANGED
|
@@ -3,17 +3,17 @@ import type { RuleConfigValue, Violation } from '@markuplint/ml-config';
|
|
|
3
3
|
import { ParserError } from '@markuplint/parser-utils';
|
|
4
4
|
import { Document } from './ml-dom';
|
|
5
5
|
export declare type MLCoreParams = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
sourceCode: string;
|
|
7
|
+
filename: string;
|
|
8
|
+
debug?: boolean;
|
|
9
9
|
} & MLFabric;
|
|
10
10
|
export declare class MLCore {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
#private;
|
|
12
|
+
constructor({ parser, sourceCode, ruleset, rules, locale, schemas, parserOptions, filename, debug }: MLCoreParams);
|
|
13
|
+
get document(): ParserError | Document<RuleConfigValue, unknown>;
|
|
14
|
+
verify(fix?: boolean): Promise<Violation[]>;
|
|
15
|
+
setCode(sourceCode: string): void;
|
|
16
|
+
update({ parser, ruleset, rules, locale, schemas, parserOptions }: Partial<MLFabric>): void;
|
|
17
|
+
private _parse;
|
|
18
|
+
private _createDocument;
|
|
19
19
|
}
|
package/lib/ml-dom/document.d.ts
CHANGED
|
@@ -12,61 +12,70 @@ import { MLDOMDoctype } from './tokens';
|
|
|
12
12
|
* markuplint DOM Document
|
|
13
13
|
*/
|
|
14
14
|
export default class MLDOMDocument<T extends RuleConfigValue, O = null> {
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
15
|
+
#private;
|
|
16
|
+
/**
|
|
17
|
+
* An array of markuplint DOM nodes
|
|
18
|
+
*/
|
|
19
|
+
nodeList: ReadonlyArray<AnonymousNode<T, O>>;
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
currentRule: MLRule<T, O> | null;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
isFragment: boolean;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
specs: Readonly<MLMLSpec>;
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
readonly endTag: 'xml' | 'omittable' | 'never';
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
readonly nodeStore: NodeStore;
|
|
40
|
+
/**
|
|
41
|
+
* It could be used in rule, make sure it is immutable
|
|
42
|
+
*/
|
|
43
|
+
get filename(): string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @param ast node list of markuplint AST
|
|
47
|
+
* @param ruleset ruleset object
|
|
48
|
+
*/
|
|
49
|
+
constructor(
|
|
50
|
+
ast: MLASTDocument,
|
|
51
|
+
ruleset: Ruleset,
|
|
52
|
+
schemas: readonly [MLMLSpec, ...ExtendedSpec[]],
|
|
53
|
+
options?: {
|
|
54
|
+
filename?: string;
|
|
55
|
+
tagNameCaseSensitive?: boolean;
|
|
56
|
+
endTag?: 'xml' | 'omittable' | 'never';
|
|
57
|
+
},
|
|
58
|
+
);
|
|
59
|
+
get doctype(): MLDOMDoctype<T, O> | null;
|
|
60
|
+
get tree(): AnonymousNode<T, O>[];
|
|
61
|
+
walk(walker: Walker<T, O>): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
*
|
|
64
|
+
* @param type
|
|
65
|
+
* @param walker
|
|
66
|
+
* @param skipWhenRuleIsDisabled
|
|
67
|
+
*/
|
|
68
|
+
walkOn(type: 'Element', walker: Walker<T, O, MLDOMElement<T, O>>, skipWhenRuleIsDisabled?: boolean): Promise<void>;
|
|
69
|
+
walkOn(type: 'Text', walker: Walker<T, O, MLDOMText<T, O>>, skipWhenRuleIsDisabled?: boolean): Promise<void>;
|
|
70
|
+
walkOn(type: 'Comment', walker: Walker<T, O, MLDOMComment<T, O>>, skipWhenRuleIsDisabled?: boolean): Promise<void>;
|
|
71
|
+
walkOn(
|
|
72
|
+
type: 'ElementCloseTag',
|
|
73
|
+
walker: Walker<T, O, MLDOMElementCloseTag<T, O>>,
|
|
74
|
+
skipWhenRuleIsDisabled?: boolean,
|
|
75
|
+
): Promise<void>;
|
|
76
|
+
setRule(rule: MLRule<T, O> | null): void;
|
|
77
|
+
matchNodes(query: string): MLDOMElement<T, O>[];
|
|
78
|
+
toString(): string;
|
|
79
|
+
debugMap(): string[];
|
|
80
|
+
private _ruleMapping;
|
|
72
81
|
}
|
|
@@ -3,4 +3,8 @@ import type { MappedNode } from './mapped-nodes';
|
|
|
3
3
|
import type { MLASTAbstructNode } from '@markuplint/ml-ast';
|
|
4
4
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
5
5
|
import { MLDOMElement } from '../tokens';
|
|
6
|
-
export declare function createNode<N extends MLASTAbstructNode, T extends RuleConfigValue, O = null>(
|
|
6
|
+
export declare function createNode<N extends MLASTAbstructNode, T extends RuleConfigValue, O = null>(
|
|
7
|
+
astNode: N,
|
|
8
|
+
document: Document<T, O>,
|
|
9
|
+
pearNode?: MLDOMElement<T, O>,
|
|
10
|
+
): MappedNode<N, T, O>;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import type { AnonymousNode } from '@markuplint/ml-core';
|
|
2
|
-
export declare function nodeListToDebugMaps(
|
|
2
|
+
export declare function nodeListToDebugMaps(
|
|
3
|
+
nodeList: Readonly<AnonymousNode<any, any>[]>,
|
|
4
|
+
withAttr?: boolean,
|
|
5
|
+
): string[];
|
|
@@ -7,12 +7,12 @@ import type { AnonymousNode } from '../types';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare function getIndent(node: AnonymousNode<any, any>): MLDOMIndentation | null;
|
|
9
9
|
declare class MLDOMIndentation {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
#private;
|
|
11
|
+
readonly line: number;
|
|
12
|
+
constructor(originTextNode: MLDOMText<any, any>, raw: string, line: number, parentNode: MLDOMNode<any, any>);
|
|
13
|
+
get type(): 'tab' | 'space' | 'mixed' | 'none';
|
|
14
|
+
get width(): number;
|
|
15
|
+
get raw(): string;
|
|
16
|
+
fix(raw: string): void;
|
|
17
17
|
}
|
|
18
18
|
export {};
|
|
@@ -1,4 +1,52 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type {
|
|
2
|
+
MLDOMAttribute,
|
|
3
|
+
MLDOMComment,
|
|
4
|
+
MLDOMDoctype,
|
|
5
|
+
MLDOMElement,
|
|
6
|
+
MLDOMElementCloseTag,
|
|
7
|
+
MLDOMNode,
|
|
8
|
+
MLDOMOmittedElement,
|
|
9
|
+
MLDOMPreprocessorSpecificBlock,
|
|
10
|
+
MLDOMText,
|
|
11
|
+
MLDOMToken,
|
|
12
|
+
} from '../tokens';
|
|
13
|
+
import type {
|
|
14
|
+
MLASTAbstructNode,
|
|
15
|
+
MLASTAttr,
|
|
16
|
+
MLASTComment,
|
|
17
|
+
MLASTDoctype,
|
|
18
|
+
MLASTElement,
|
|
19
|
+
MLASTElementCloseTag,
|
|
20
|
+
MLASTNode,
|
|
21
|
+
MLASTOmittedElement,
|
|
22
|
+
MLASTParentNode,
|
|
23
|
+
MLASTPreprocessorSpecificBlock,
|
|
24
|
+
MLASTText,
|
|
25
|
+
MLToken,
|
|
26
|
+
} from '@markuplint/ml-ast/';
|
|
3
27
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
4
|
-
export declare type MappedNode<N, T extends RuleConfigValue, O = null> = N extends MLASTElement
|
|
28
|
+
export declare type MappedNode<N, T extends RuleConfigValue, O = null> = N extends MLASTElement
|
|
29
|
+
? MLDOMElement<T, O>
|
|
30
|
+
: N extends MLASTElementCloseTag
|
|
31
|
+
? MLDOMElementCloseTag<T, O>
|
|
32
|
+
: N extends MLASTOmittedElement
|
|
33
|
+
? MLDOMOmittedElement<T, O>
|
|
34
|
+
: N extends MLASTParentNode
|
|
35
|
+
? MLDOMElement<T, O> | MLDOMOmittedElement<T, O>
|
|
36
|
+
: N extends MLASTComment
|
|
37
|
+
? MLDOMComment<T, O>
|
|
38
|
+
: N extends MLASTText
|
|
39
|
+
? MLDOMText<T, O>
|
|
40
|
+
: N extends MLASTDoctype
|
|
41
|
+
? MLDOMDoctype<T, O>
|
|
42
|
+
: N extends MLASTNode
|
|
43
|
+
? MLDOMNode<T, O, MLASTNode>
|
|
44
|
+
: N extends MLASTPreprocessorSpecificBlock
|
|
45
|
+
? MLDOMPreprocessorSpecificBlock<T, O>
|
|
46
|
+
: N extends MLASTAbstructNode
|
|
47
|
+
? MLDOMNode<T, O, MLASTAbstructNode>
|
|
48
|
+
: N extends MLASTAttr
|
|
49
|
+
? MLDOMAttribute
|
|
50
|
+
: N extends MLToken
|
|
51
|
+
? MLDOMToken<MLToken>
|
|
52
|
+
: never;
|
|
@@ -3,14 +3,18 @@ import type { Specificity } from './selector';
|
|
|
3
3
|
import type { RegexSelector } from '@markuplint/ml-config';
|
|
4
4
|
export declare type SelectorMatches = SelectorMatched | SelectorUnmatched;
|
|
5
5
|
declare type SelectorMatched = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
matched: true;
|
|
7
|
+
selector: string;
|
|
8
|
+
specificity: Specificity;
|
|
9
|
+
data?: Record<string, string>;
|
|
10
10
|
};
|
|
11
11
|
declare type SelectorUnmatched = {
|
|
12
|
-
|
|
12
|
+
matched: false;
|
|
13
13
|
};
|
|
14
14
|
declare type TargetElement = MLDOMAbstractElement<any, any>;
|
|
15
|
-
export declare function matchSelector(
|
|
15
|
+
export declare function matchSelector(
|
|
16
|
+
el: TargetElement,
|
|
17
|
+
selector: string | RegexSelector | undefined,
|
|
18
|
+
tagNameCaseSensitive?: boolean,
|
|
19
|
+
): SelectorMatches;
|
|
16
20
|
export {};
|
|
@@ -3,7 +3,10 @@ import type { MappedNode } from './mapped-nodes';
|
|
|
3
3
|
import type { MLASTAbstructNode } from '@markuplint/ml-ast';
|
|
4
4
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
5
5
|
export default class NodeStore {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
#private;
|
|
7
|
+
setNode<A extends MLASTAbstructNode, T extends RuleConfigValue, O = null>(
|
|
8
|
+
astNode: A,
|
|
9
|
+
node: MLDOMNode<T, O, A>,
|
|
10
|
+
): void;
|
|
11
|
+
getNode<N extends MLASTAbstructNode, T extends RuleConfigValue, O = null>(astNode: N): MappedNode<N, T, O>;
|
|
9
12
|
}
|
|
@@ -4,8 +4,8 @@ export declare function createSelector(selector: string, tagNameCaseSensitive?:
|
|
|
4
4
|
export declare function compareSpecificity(a: Specificity, b: Specificity): 0 | 1 | -1;
|
|
5
5
|
declare type TargetElement = MLDOMAbstractElement<any, any>;
|
|
6
6
|
declare class Selector {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
#private;
|
|
8
|
+
constructor(selector: string, tagNameCaseSensitive: boolean);
|
|
9
|
+
match(el: TargetElement, caller?: TargetElement | null): Specificity | false;
|
|
10
10
|
}
|
|
11
11
|
export {};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { AnonymousNode } from '../types';
|
|
2
2
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
3
|
-
export declare type Walker<T extends RuleConfigValue, O = null, N = AnonymousNode<T, O>> = (
|
|
3
|
+
export declare type Walker<T extends RuleConfigValue, O = null, N = AnonymousNode<T, O>> = (
|
|
4
|
+
node: N,
|
|
5
|
+
) => void | Promise<void>;
|
|
4
6
|
export declare type SyncWalker<T extends RuleConfigValue, O = null, N = AnonymousNode<T, O>> = (node: N) => void;
|
|
5
|
-
export declare function syncWalk<T extends RuleConfigValue, O = null>(
|
|
7
|
+
export declare function syncWalk<T extends RuleConfigValue, O = null>(
|
|
8
|
+
nodeList: AnonymousNode<T, O>[],
|
|
9
|
+
walker: SyncWalker<T, O>,
|
|
10
|
+
): void;
|
package/lib/ml-dom/index.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
export { default as Document } from './document';
|
|
2
2
|
export { AnonymousNode, NodeType } from './types';
|
|
3
|
-
export {
|
|
3
|
+
export {
|
|
4
|
+
MLDOMAttribute as Attribute,
|
|
5
|
+
MLDOMComment as Comment,
|
|
6
|
+
MLDOMDoctype as Doctype,
|
|
7
|
+
MLDOMElement as Element,
|
|
8
|
+
MLDOMElementCloseTag as ElementCloseTag,
|
|
9
|
+
MLDOMNode as Node,
|
|
10
|
+
MLDOMOmittedElement as OmittedElement,
|
|
11
|
+
MLDOMText as Text,
|
|
12
|
+
} from './tokens';
|
|
@@ -3,14 +3,14 @@ import type { AnonymousNode } from './types';
|
|
|
3
3
|
import type { AnyRule } from '@markuplint/ml-config';
|
|
4
4
|
declare type RuleType = 'rules' | 'nodeRules' | 'childNodeRules';
|
|
5
5
|
declare type MappingLayer = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
from: RuleType;
|
|
7
|
+
specificity: Specificity;
|
|
8
|
+
rule: AnyRule;
|
|
9
9
|
};
|
|
10
10
|
export declare class RuleMapper<N extends AnonymousNode<any, any> = AnonymousNode<any, any>> {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
#private;
|
|
12
|
+
constructor(nodeList: ReadonlyArray<N>);
|
|
13
|
+
set(node: N, ruleName: string, rule: MappingLayer): void;
|
|
14
|
+
apply(): void;
|
|
15
15
|
}
|
|
16
16
|
export {};
|
|
@@ -5,40 +5,44 @@ import type { MLASTElement, MLASTOmittedElement } from '@markuplint/ml-ast';
|
|
|
5
5
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
6
6
|
import type { ContentModel } from '@markuplint/ml-spec';
|
|
7
7
|
import MLDOMNode from './node';
|
|
8
|
-
export default abstract class MLDOMAbstractElement<
|
|
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
|
-
|
|
8
|
+
export default abstract class MLDOMAbstractElement<
|
|
9
|
+
T extends RuleConfigValue,
|
|
10
|
+
O = null,
|
|
11
|
+
E extends MLASTElement | MLASTOmittedElement = MLASTElement | MLASTOmittedElement,
|
|
12
|
+
> extends MLDOMNode<T, O, E> {
|
|
13
|
+
#private;
|
|
14
|
+
readonly nodeName: string;
|
|
15
|
+
readonly attributes: (MLDOMAttribute | MLDOMPreprocessorSpecificAttribute)[];
|
|
16
|
+
readonly hasSpreadAttr: boolean;
|
|
17
|
+
readonly namespaceURI: string;
|
|
18
|
+
readonly isForeignElement: boolean;
|
|
19
|
+
readonly ownModels: Set<ContentModel>;
|
|
20
|
+
readonly childModels: Set<ContentModel>;
|
|
21
|
+
readonly descendantModels: Set<ContentModel>;
|
|
22
|
+
readonly isCustomElement: boolean;
|
|
23
|
+
readonly isInFragmentDocument: boolean;
|
|
24
|
+
constructor(astNode: E, document: Document<T, O>);
|
|
25
|
+
get childNodes(): AnonymousNode<T, O>[];
|
|
26
|
+
get children(): (MLDOMElement<T, O> | MLDOMOmittedElement<T, O>)[];
|
|
27
|
+
get nextElementSibling(): MLDOMElement<T, O> | MLDOMOmittedElement<T, O> | null;
|
|
28
|
+
get previousElementSibling(): MLDOMElement<T, O> | MLDOMOmittedElement<T, O> | null;
|
|
29
|
+
get ns(): string;
|
|
30
|
+
get nameWithNS(): string;
|
|
31
|
+
get classList(): string[];
|
|
32
|
+
get id(): string;
|
|
33
|
+
get fixedNodeName(): string;
|
|
34
|
+
querySelectorAll(selector: string): (MLDOMElement<T, O> | MLDOMText<T, O>)[];
|
|
35
|
+
closest(selector: string): MLDOMAbstractElement<T, O> | null;
|
|
36
|
+
getAttributeToken(attrName: string): (MLDOMAttribute | MLDOMPreprocessorSpecificAttribute)[];
|
|
37
|
+
getAttribute(attrName: string): string | null;
|
|
38
|
+
hasAttribute(attrName: string): boolean;
|
|
39
|
+
matches(selector: string): boolean;
|
|
40
|
+
fixNodeName(name: string): void;
|
|
41
|
+
getChildElementsAndTextNodeWithoutWhitespaces(): (MLDOMElement<T, O> | MLDOMText<T, O>)[];
|
|
42
|
+
/**
|
|
43
|
+
* This element has "Preprocessor Specific Block". In other words, Its children are potentially mutable.
|
|
44
|
+
*/
|
|
45
|
+
hasMutableChildren(): boolean;
|
|
46
|
+
isDescendantByUUIDList(uuidList: string[]): boolean;
|
|
47
|
+
toNormalizeString(): string;
|
|
44
48
|
}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import type { MLASTHTMLAttr, MLToken } from '@markuplint/ml-ast';
|
|
2
2
|
import MLDOMToken from './token';
|
|
3
3
|
export default class MLDOMAttribute extends MLDOMToken<MLASTHTMLAttr> {
|
|
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
|
-
|
|
4
|
+
readonly attrType = 'html-attr';
|
|
5
|
+
readonly name: MLDOMToken<MLToken>;
|
|
6
|
+
readonly spacesBeforeName: MLDOMToken<MLToken>;
|
|
7
|
+
readonly spacesBeforeEqual: MLDOMToken<MLToken>;
|
|
8
|
+
readonly equal: MLDOMToken<MLToken>;
|
|
9
|
+
readonly spacesAfterEqual: MLDOMToken<MLToken>;
|
|
10
|
+
readonly startQuote: MLDOMToken<MLToken>;
|
|
11
|
+
readonly value: MLDOMToken<MLToken>;
|
|
12
|
+
readonly endQuote: MLDOMToken<MLToken>;
|
|
13
|
+
readonly isDynamicValue?: true;
|
|
14
|
+
readonly isDirective?: true;
|
|
15
|
+
readonly potentialName: string;
|
|
16
|
+
readonly candidate?: string;
|
|
17
|
+
readonly isDuplicatable: boolean;
|
|
18
|
+
constructor(astToken: MLASTHTMLAttr);
|
|
19
|
+
get raw(): string;
|
|
20
|
+
get startOffset(): number;
|
|
21
|
+
get endOffset(): number;
|
|
22
|
+
get startLine(): number;
|
|
23
|
+
get endLine(): number;
|
|
24
|
+
get startCol(): number;
|
|
25
|
+
get endCol(): number;
|
|
26
|
+
getName(): {
|
|
27
|
+
line: number;
|
|
28
|
+
col: number;
|
|
29
|
+
potential: string;
|
|
30
|
+
raw: string;
|
|
31
|
+
};
|
|
32
|
+
getValue(): {
|
|
33
|
+
line: number;
|
|
34
|
+
col: number;
|
|
35
|
+
potential: string;
|
|
36
|
+
raw: string;
|
|
37
|
+
};
|
|
38
|
+
toString(withSpace?: boolean): string;
|
|
39
|
+
toNormalizeString(): string;
|
|
40
40
|
}
|
|
@@ -2,6 +2,9 @@ import type { IMLDOMComment } from '../types';
|
|
|
2
2
|
import type { MLASTComment } from '@markuplint/ml-ast';
|
|
3
3
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
4
4
|
import MLDOMNode from './node';
|
|
5
|
-
export default class MLDOMComment<T extends RuleConfigValue, O = null>
|
|
6
|
-
|
|
5
|
+
export default class MLDOMComment<T extends RuleConfigValue, O = null>
|
|
6
|
+
extends MLDOMNode<T, O, MLASTComment>
|
|
7
|
+
implements IMLDOMComment
|
|
8
|
+
{
|
|
9
|
+
readonly type = 'Comment';
|
|
7
10
|
}
|
|
@@ -3,11 +3,14 @@ import type { IMLDOMDoctype } from '../types';
|
|
|
3
3
|
import type { MLASTDoctype, MLASTNode } from '@markuplint/ml-ast';
|
|
4
4
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
5
5
|
import MLDOMNode from './node';
|
|
6
|
-
export default class MLDOMDoctype<T extends RuleConfigValue, O = null>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
export default class MLDOMDoctype<T extends RuleConfigValue, O = null>
|
|
7
|
+
extends MLDOMNode<T, O, MLASTNode>
|
|
8
|
+
implements IMLDOMDoctype
|
|
9
|
+
{
|
|
10
|
+
#private;
|
|
11
|
+
readonly type = 'Doctype';
|
|
12
|
+
constructor(astNode: MLASTDoctype, document: Document<T, O>);
|
|
13
|
+
get name(): string;
|
|
14
|
+
get publicId(): string;
|
|
15
|
+
get systemId(): string;
|
|
13
16
|
}
|
|
@@ -4,20 +4,23 @@ import type { MLDOMElement } from './';
|
|
|
4
4
|
import type { MLASTElementCloseTag } from '@markuplint/ml-ast';
|
|
5
5
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
6
6
|
import MLDOMNode from './node';
|
|
7
|
-
export default class MLDOMElementCloseTag<T extends RuleConfigValue, O = null>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
export default class MLDOMElementCloseTag<T extends RuleConfigValue, O = null>
|
|
8
|
+
extends MLDOMNode<T, O, MLASTElementCloseTag>
|
|
9
|
+
implements IMLDOMElementCloseTag
|
|
10
|
+
{
|
|
11
|
+
#private;
|
|
12
|
+
readonly type = 'ElementCloseTag';
|
|
13
|
+
readonly nodeName: string;
|
|
14
|
+
readonly startTag: MLDOMElement<T, O>;
|
|
15
|
+
readonly isForeignElement: boolean;
|
|
16
|
+
readonly isCustomElement: boolean;
|
|
17
|
+
constructor(astNode: MLASTElementCloseTag, document: Document<T, O>, startTag: MLDOMElement<T, O>);
|
|
18
|
+
get raw(): string;
|
|
19
|
+
get rule(): import('@markuplint/ml-config').RuleInfo<T, O>;
|
|
20
|
+
fixNodeName(name: string): void;
|
|
21
|
+
getNameLocation(): {
|
|
22
|
+
offset: number;
|
|
23
|
+
line: number;
|
|
24
|
+
col: number;
|
|
25
|
+
};
|
|
23
26
|
}
|