Skip to content

Commit 8c87dbc

Browse files
Prevent an error with figures lacking a caption
1 parent 79421d9 commit 8c87dbc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/convertHTMLtoPortableText.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function convertHTMLtoPortableText (HTMLDoc) {
3737
_sanityAsset: `image@${img.getAttribute("src")}`
3838
},
3939
alt: img.getAttribute("alt"),
40-
caption: caption.textContent
40+
caption: caption ? caption.textContent : ''
4141
});
4242
}
4343
},
@@ -109,4 +109,4 @@ function convertHTMLtoPortableText (HTMLDoc) {
109109
parseHtml: html => new JSDOM(html).window.document
110110
})
111111
}
112-
module.exports = convertHTMLtoPortableText
112+
module.exports = convertHTMLtoPortableText

0 commit comments

Comments
 (0)