Skip to content

Commit 11ea54c

Browse files
committed
Add notes on different frameworks
1 parent 7867d68 commit 11ea54c

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

lib/index.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,32 @@ import {createState} from './state.js'
2626
/**
2727
* Transform a hast tree (with embedded MDX nodes) into an estree.
2828
*
29-
* ###### Notes
29+
* ##### Notes
30+
*
31+
* ###### Comments
3032
*
3133
* Comments are attached to the tree in their neighbouring nodes (`recast`,
3234
* `babel` style) and also added as a `comments` array on the program node
3335
* (`espree` style).
3436
* You may have to do `program.comments = undefined` for certain compilers.
3537
*
38+
* ###### Frameworks
39+
*
40+
* There are differences between what JSX frameworks accept, such as whether they
41+
* accept `class` or `className`, or `background-color` or `backgroundColor`.
42+
*
43+
* For JSX components written in MDX, the author has to be aware of this
44+
* difference and write code accordingly.
45+
* For hast elements transformed by this project, this will be handled through
46+
* options.
47+
*
48+
* | Framework | `elementAttributeNameCase` | `stylePropertyNameCase` |
49+
* | --------- | -------------------------- | ----------------------- |
50+
* | Preact | `'html'` | `'dom'` |
51+
* | React | `'react'` | `'dom'` |
52+
* | Solid | `'html'` | `'css'` |
53+
* | Vue | `'html'` | `'dom'` |
54+
*
3655
* @param {Node} tree
3756
* hast tree.
3857
* @param {Options | null | undefined} [options]

readme.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,32 @@ There is no default export.
157157
Transform a hast tree (with embedded MDX nodes) into an estree (with JSX
158158
nodes).
159159

160-
###### Notes
160+
##### Notes
161+
162+
###### Comments
161163

162164
Comments are attached to the tree in their neighbouring nodes (`recast`,
163165
`babel` style) and also added as a `comments` array on the program node
164166
(`espree` style).
165167
You may have to do `program.comments = undefined` for certain compilers.
166168

169+
###### Frameworks
170+
171+
There are differences between what JSX frameworks accept, such as whether they
172+
accept `class` or `className`, or `background-color` or `backgroundColor`.
173+
174+
For JSX components written in MDX, the author has to be aware of this
175+
difference and write code accordingly.
176+
For hast elements transformed by this project, this will be handled through
177+
options.
178+
179+
| Framework | `elementAttributeNameCase` | `stylePropertyNameCase` |
180+
| --------- | -------------------------- | ----------------------- |
181+
| Preact | `'html'` | `'dom'` |
182+
| React | `'react'` | `'dom'` |
183+
| Solid | `'html'` | `'css'` |
184+
| Vue | `'html'` | `'dom'` |
185+
167186
###### Parameters
168187

169188
* `tree` ([`HastNode`][hast-node])

0 commit comments

Comments
 (0)