File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed
Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,5 @@ test(`it leaves non-relative HTML img tags alone`, async () => {
144144 ` . trim ( )
145145
146146 const nodes = await plugin ( createPluginOptions ( content , imagePath ) )
147-
148- expect ( nodes . length ) . toBe ( 0 )
147+ expect ( nodes [ 0 ] . value ) . toBe ( content )
149148} )
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ module.exports = (
5252 }
5353 return null
5454 } )
55+
5556 if ( ! imageNode || ! imageNode . absolutePath ) {
5657 return resolve ( )
5758 }
@@ -142,15 +143,16 @@ module.exports = (
142143 ) {
143144 const rawHTML = await generateImagesAndUpdateNode ( node , resolve )
144145
145- if ( rawHTML != null ) {
146+ if ( rawHTML ) {
146147 // Replace the image node with an inline HTML node.
147148 node . type = `html`
148149 node . value = rawHTML
149150 }
151+ return resolve ( node )
152+ } else {
153+ // Image isn't relative so there's nothing for us to do.
154+ return resolve ( )
150155 }
151-
152- // Image isn't relative so there's nothing for us to do.
153- return resolve ( )
154156 } )
155157 )
156158 ) . then ( markdownImageNodes =>
@@ -200,13 +202,13 @@ module.exports = (
200202 resolve
201203 )
202204
203- if ( rawHTML != null ) {
205+ if ( rawHTML ) {
204206 // Replace the image string
205207 thisImg . replaceWith ( rawHTML )
208+ } else {
209+ return resolve ( )
206210 }
207211 }
208-
209- return resolve ( )
210212 }
211213
212214 // Replace the image node with an inline HTML node.
You can’t perform that action at this time.
0 commit comments