File tree 2 files changed +36
-23
lines changed
2 files changed +36
-23
lines changed Original file line number Diff line number Diff line change 1
1
import type { Position } from 'unist'
2
-
3
- export type { Options , Space } from './lib/index.js'
2
+ import type { VFile } from 'vfile'
4
3
5
4
export { fromParse5 } from './lib/index.js'
6
5
6
+ /**
7
+ * Configuration.
8
+ */
9
+ export interface Options {
10
+ /**
11
+ * File used to add positional info to nodes (optional).
12
+ *
13
+ * If given, the file should represent the original HTML source.
14
+ */
15
+ file ?: VFile | null | undefined
16
+
17
+ /**
18
+ * Which space the document is in (default: `'html'`).
19
+ *
20
+ * When an `<svg>` element is found in the HTML space, this package already
21
+ * automatically switches to and from the SVG space when entering and exiting
22
+ * it.
23
+ */
24
+ space ?: Space | null | undefined
25
+
26
+ /**
27
+ * Whether to add extra positional info about starting tags, closing tags,
28
+ * and attributes to elements (default: `false`).
29
+ *
30
+ * > 👉 **Note**: only used when `file` is given.
31
+ */
32
+ verbose ?: boolean | null | undefined
33
+ }
34
+
35
+ /**
36
+ * Namespace.
37
+ */
38
+ export type Space = 'html' | 'svg'
39
+
7
40
// Register data on hast.
8
41
declare module 'hast' {
9
42
interface ElementData {
Original file line number Diff line number Diff line change 4
4
* @import {Schema} from 'property-information'
5
5
* @import {Point, Position} from 'unist'
6
6
* @import {VFile} from 'vfile'
7
+ * @import {Options} from 'hast-util-from-parse5'
7
8
*/
8
9
9
10
/**
10
- * @typedef Options
11
- * Configuration.
12
- * @property {Space | null | undefined } [space='html']
13
- * Which space the document is in (default: `'html'`).
14
- *
15
- * When an `<svg>` element is found in the HTML space, this package already
16
- * automatically switches to and from the SVG space when entering and exiting
17
- * it.
18
- * @property {VFile | null | undefined } [file]
19
- * File used to add positional info to nodes (optional).
20
- *
21
- * If given, the file should represent the original HTML source.
22
- * @property {boolean | null | undefined } [verbose=false]
23
- * Whether to add extra positional info about starting tags, closing tags,
24
- * and attributes to elements (default: `false`).
25
- *
26
- * > 👉 **Note**: only used when `file` is given.
27
- *
28
- * @typedef {'html' | 'svg' } Space
29
- * Namespace.
30
- *
31
11
* @typedef State
32
12
* Info passed around about the current state.
33
13
* @property {VFile | undefined } file
You can’t perform that action at this time.
0 commit comments