Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
use src
  • Loading branch information
kellyjosephprice committed May 17, 2024
commit 7de8307e9cb41559b073c5a38ddf4c9486b45f86
2 changes: 1 addition & 1 deletion __tests__/transformers/readme-components.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Second
},
image: {
md: `![](http://placekitten.com/600/200)`,
mdx: `<Image url="http://placekitten.com/600/200" />`,
mdx: `<Image src="http://placekitten.com/600/200" />`,
},
table: {
md: `
Expand Down
4 changes: 2 additions & 2 deletions processor/transform/readme-components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ const coerceJsxToMd =
parent.children[index] = mdNode;
} else if (node.name === 'Image') {
const { position } = node;
const { alt = '', url, title = null } = attributes<Pick<Image, 'alt' | 'url' | 'title'>>(node);
const { alt = '', src, title = null } = attributes<Pick<Image, 'alt' | 'title'> & { src: string }>(node);

const mdNode: Image = {
alt,
position,
title,
type: 'image',
url,
url: src,
};

parent.children[index] = mdNode;
Expand Down