Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions processor/transform/readme-to-mdx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ const readmeToMdx = (): Transform => tree => {
visit(tree, 'image', (image, index, parent) => {
if (!('data' in image)) return;

if ('url' in image) image.data.hProperties.src = image.url;
const attributes = toAttributes(image.data.hProperties, imageAttrs);
const attributes = toAttributes(
{ ...image.data.hProperties, ...('url' in image && { src: image.url }) },
imageAttrs,
);
Comment on lines +45 to +48
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh, interesting 🤔 this is a subtle refactor! So just ask to clarify: because we were actually assigning this src in to the image itself, it broke things…somewhere further along in one of our processors' "thread"? That makes sense with your fix!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is where it's erroring, something higher up in the chain is somehow freezing this prop??!?! What's annoying, is I can't seem to reproduce it local to this repo?

Just figured it out. slate uses immer and the emoji serializer is just copying all the slate node data into the mdast. I'll fix this in the main app.


if (hasExtra(attributes)) {
parent.children.splice(index, 1, {
Expand Down