-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.d.ts
82 lines (73 loc) · 2.13 KB
/
index.d.ts
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
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
72
73
74
75
76
77
78
79
80
81
82
import type {Position} from 'unist'
import type {VFile} from 'vfile'
export {fromParse5} from './lib/index.js'
/**
* Configuration.
*/
export interface Options {
/**
* File used to add positional info to nodes (optional).
*
* If given, the file should represent the original HTML source.
*/
file?: VFile | null | undefined
/**
* Which space the document is in (default: `'html'`).
*
* When an `<svg>` element is found in the HTML space, this package already
* automatically switches to and from the SVG space when entering and exiting
* it.
*/
space?: Space | null | undefined
/**
* Whether to add extra positional info about starting tags, closing tags,
* and attributes to elements (default: `false`).
*
* > 👉 **Note**: only used when `file` is given.
*/
verbose?: boolean | null | undefined
}
/**
* Namespace.
*/
export type Space = 'html' | 'svg'
// Register data on hast.
declare module 'hast' {
interface ElementData {
position: {
/**
* Positional info of the start tag of an element.
*
* Field added by `hast-util-from-parse5` (a utility used inside
* `rehype-parse` responsible for parsing HTML), when passing
* `verbose: true`.
*/
opening?: Position | undefined
/**
* Positional info of the end tag of an element.
*
* Field added by `hast-util-from-parse5` (a utility used inside
* `rehype-parse` responsible for parsing HTML), when passing
* `verbose: true`.
*/
closing?: Position | undefined
/**
* Positional info of the properties of an element.
*
* Field added by `hast-util-from-parse5` (a utility used inside
* `rehype-parse` responsible for parsing HTML), when passing
* `verbose: true`.
*/
properties?: Record<string, Position | undefined> | undefined
}
}
interface RootData {
/**
* Whether the document was using quirksmode.
*
* Field added by `hast-util-from-parse5` (a utility used inside
* `rehype-parse` responsible for parsing HTML).
*/
quirksMode?: boolean | undefined
}
}