File tree Expand file tree Collapse file tree 2 files changed +36
-23
lines changed Expand file tree Collapse file tree 2 files changed +36
-23
lines changed Original file line number Diff line number Diff line change 11import type { Position } from 'unist'
2-
3- export type { Options , Space } from './lib/index.js'
2+ import type { VFile } from 'vfile'
43
54export { fromParse5 } from './lib/index.js'
65
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+
740// Register data on hast.
841declare module 'hast' {
942 interface ElementData {
Original file line number Diff line number Diff line change 44 * @import {Schema} from 'property-information'
55 * @import {Point, Position} from 'unist'
66 * @import {VFile} from 'vfile'
7+ * @import {Options} from 'hast-util-from-parse5'
78 */
89
910/**
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- *
3111 * @typedef State
3212 * Info passed around about the current state.
3313 * @property {VFile | undefined } file
You can’t perform that action at this time.
0 commit comments