fix(mdx): handle inline html correctly (#5704)
This commit is contained in:
3 files changed
+33
-1
No files matched your search
@@ -55,7 +55,9 @@ function htmlToJsx() {
|
||||
node.type !== "html" ||
|
||||
/^<!--[\s\S]*-->$/.test(node.value) ||
|
||||
// inline html
|
||||
parent.type === "paragraph"
|
||||
(parent.type === "paragraph" ||
|
||||
parent.type === "tableCell" ||
|
||||
parent.type === "heading")
|
||||
) {
|
||||
return node;
|
||||
}
|
||||
|
||||
@@ -188,6 +188,12 @@ printWidth: 80
|
||||
test <World /> test
|
||||
</Hello>
|
||||
|
||||
---
|
||||
|
||||
| Column 1 | Column 2 |
|
||||
|---|---|
|
||||
| Text | <Hello>Text</Hello> |
|
||||
|
||||
=====================================output=====================================
|
||||
<Heading hi="there">Hello, world!</Heading>
|
||||
|
||||
@@ -197,6 +203,12 @@ printWidth: 80
|
||||
test <World /> test
|
||||
</Hello>
|
||||
|
||||
---
|
||||
|
||||
| Column 1 | Column 2 |
|
||||
| -------- | ------------------- |
|
||||
| Text | <Hello>Text</Hello> |
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
@@ -216,6 +228,12 @@ semi: false
|
||||
test <World /> test
|
||||
</Hello>
|
||||
|
||||
---
|
||||
|
||||
| Column 1 | Column 2 |
|
||||
|---|---|
|
||||
| Text | <Hello>Text</Hello> |
|
||||
|
||||
=====================================output=====================================
|
||||
<Heading hi="there">Hello, world!</Heading>
|
||||
|
||||
@@ -225,6 +243,12 @@ semi: false
|
||||
test <World /> test
|
||||
</Hello>
|
||||
|
||||
---
|
||||
|
||||
| Column 1 | Column 2 |
|
||||
| -------- | ------------------- |
|
||||
| Text | <Hello>Text</Hello> |
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
|
||||
@@ -6,3 +6,9 @@
|
||||
<Hello>
|
||||
test <World /> test
|
||||
</Hello>
|
||||
|
||||
---
|
||||
|
||||
| Column 1 | Column 2 |
|
||||
|---|---|
|
||||
| Text | <Hello>Text</Hello> |
|
||||
Reference in new issue
Block a user