-
Notifications
You must be signed in to change notification settings - Fork 780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deserialiseMd created an invalid TElement array #2173
Comments
Thanks for the bug report! As you say, pasting an image is enough to cause the error. There's a slightly different error message if the alt text is empty. ![Minion](https://octodex.github.com/images/minion.png)
![](https://octodex.github.com/images/minion.png) |
There are a few issues on remark-slate, the package used by Plate to convert markdown to Slate nodes, relating to this problem. See #44, for example. Ideally, the configuration in Plate should work out of the box. We might need to open a PR on remark-slate to add the configuration options necessary for that. I've tested PR #45, which fixes the error but still produces an invalid image node. |
PR #45 combined with Node produced by HTML deserializer {
"type": "img",
"url": "https://octodex.github.com/images/minion.png",
"children": [
{
"text": ""
}
]
}, Node produced by markdown deserializer {
"type": "p",
"children": [
{
"type": "img",
"children": [
{
"text": ""
}
],
"url": "https://octodex.github.com/images/minion.png",
"caption": [
{
"text": "Minion"
}
]
}
]
} |
@12joan It looks like remark-slate author is inactive – one PR has been open for a year now. Let's fork its src into the deserializer-md package.
|
Description
when trying to deserialise markdown, the function produces invalid TElement array structure that results in
Cannot read properties of undefined (reading 'map')
error.it seems like it breaks with images, it converts them to nodes that contain caption and link instead of url.
the caption part seems to be the breaking part.
example:
Steps
Funding
The text was updated successfully, but these errors were encountered: