-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
index.d.ts
47 lines (44 loc) · 1.52 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
import type {Root} from 'hast'
import type {Plugin} from 'unified'
import type {Options} from './lib/index.js'
export type {Components, Options} from 'hast-util-to-jsx-runtime'
/**
* Turn HTML into preact, react, solid, svelte, vue, etc.
*
* ###### Result
*
* This plugin registers a compiler that returns a `JSX.Element` where
* compilers typically return `string`.
* When using `.stringify` on `unified`, the result is such a `JSX.Element`.
* When using `.process` (or `.processSync`), the result is available at
* `file.result`.
*
* ###### Frameworks
*
* There are differences between what JSX frameworks accept, such as whether
* they accept `class` or `className`, or `background-color` or
* `backgroundColor`.
*
* For hast elements transformed by this project, this is be handled through
* options:
*
* | Framework | `elementAttributeNameCase` | `stylePropertyNameCase` |
* | --------- | -------------------------- | ----------------------- |
* | Preact | `'html'` | `'dom'` |
* | React | `'react'` | `'dom'` |
* | Solid | `'html'` | `'css'` |
* | Vue | `'html'` | `'dom'` |
*
* @param options
* Configuration (required).
* @returns
* Nothing.
*/
declare const rehypeReact: Plugin<[Options], Root, JSX.Element>
export default rehypeReact
// Register the result type.
declare module 'unified' {
interface CompileResultMap {
JsxElement: JSX.Element
}
}