diff --git a/__tests__/__snapshots__/index.test.js.snap b/__tests__/__snapshots__/index.test.js.snap
index 034b28108..a7330bb0b 100644
--- a/__tests__/__snapshots__/index.test.js.snap
+++ b/__tests__/__snapshots__/index.test.js.snap
@@ -335,7 +335,7 @@ exports[`export multiple Markdown renderers > renders plain markdown as React 1`
exports[`heading 1`] = `"
Example Header
"`;
-exports[`image 1`] = `"
"`;
+exports[`image 1`] = `"
"`;
exports[`list items 1`] = `
"
diff --git a/__tests__/components/Image.test.tsx b/__tests__/components/Image.test.tsx
index c075e51e9..6e3f9f4a9 100644
--- a/__tests__/components/Image.test.tsx
+++ b/__tests__/components/Image.test.tsx
@@ -10,7 +10,7 @@ describe('Image', () => {
expect(screen.getByRole('img')).toMatchInlineSnapshot(`
{
-
-
-
- A pizza bro
-
-
+
+
+ A pizza bro
+
`);
diff --git a/__tests__/components/__snapshots__/index.test.ts.snap b/__tests__/components/__snapshots__/index.test.ts.snap
index 8bfa44ee2..110832099 100644
--- a/__tests__/components/__snapshots__/index.test.ts.snap
+++ b/__tests__/components/__snapshots__/index.test.ts.snap
@@ -10,4 +10,4 @@ exports[`Components > Embed 3`] = `""`;
-exports[`Components > Image 1`] = `"
"`;
+exports[`Components > Image 1`] = `"
"`;
diff --git a/components/Image/index.tsx b/components/Image/index.tsx
index 3785e3bf0..a4a983893 100644
--- a/components/Image/index.tsx
+++ b/components/Image/index.tsx
@@ -16,7 +16,7 @@ interface ImageProps {
const Image = (Props: ImageProps) => {
const {
- align = '',
+ align = 'center',
alt = '',
border = false,
caption,
@@ -25,7 +25,7 @@ const Image = (Props: ImageProps) => {
src,
title = '',
width = 'auto',
- lazy = false,
+ lazy = true,
children,
} = Props;
@@ -60,55 +60,53 @@ const Image = (Props: ImageProps) => {
if (caption) {
return (
-
-
-
+
+
+
{children || caption}
-
+
-
+
);
}
return (
-
-
-
-
-
+
+
+
-
+
);
};
diff --git a/processor/compile/compatibility.ts b/processor/compile/compatibility.ts
index 69c32051f..a64c3258c 100644
--- a/processor/compile/compatibility.ts
+++ b/processor/compile/compatibility.ts
@@ -32,14 +32,16 @@ const html = (node: Html) => {
};
const figureToImageBlock = (node: any) => {
- const { align, width, src, alt, title, ...image } = node.children.find((child: Node) => child.type === 'image');
+ const { align, width, src, url, alt, title, ...image } = node.children.find((child: Node) => child.type === 'image');
const { className } = image.data.hProperties;
const figcaption = node.children.find((child: Node) => child.type === 'figcaption');
- const caption = figcaption ? toMarkdown({
- type: 'paragraph',
- children: figcaption.children,
- }).trim() : null;
+ const caption = figcaption
+ ? toMarkdown({
+ type: 'paragraph',
+ children: figcaption.children,
+ }).trim()
+ : null;
const attributes = {
...(align && { align }),
@@ -48,10 +50,19 @@ const figureToImageBlock = (node: any) => {
...(caption && { caption }),
...(title && { title }),
...(width && { width }),
- src,
+ src: src || url,
};
return ``;
-}
+};
+
+const embedToEmbedBlock = (node: any) => {
+ const { html, ...embed } = node.data.hProperties;
+ const attributes = {
+ ...embed,
+ ...(html && { html: encodeURIComponent(html) }),
+ };
+ return ``;
+};
const compatibility = (node: CompatNodes) => {
switch (node.type) {
@@ -68,8 +79,7 @@ const compatibility = (node: CompatNodes) => {
case 'figure':
return figureToImageBlock(node);
case 'embed':
- const attributes = formatHProps(node);
- return ``;
+ return embedToEmbedBlock(node);
default:
throw new Error('Unhandled node type!');
}