diff --git a/src/transform/plugins/images/index.ts b/src/transform/plugins/images/index.ts index b86b56c1..ff52c46d 100644 --- a/src/transform/plugins/images/index.ts +++ b/src/transform/plugins/images/index.ts @@ -10,6 +10,7 @@ import {StateCore} from '../../typings'; interface ImageOpts extends MarkdownItPluginOpts { assetsPublicPath: string; + inlineSvg?: boolean; } function replaceImageSrc( @@ -94,8 +95,9 @@ const index: MarkdownItPluginCb = (md, opts) => { } const imgSrc = childrenTokens[j].attrGet('src') || ''; + const shouldInlineSvg = opts.inlineSvg !== false && !isExternalHref(imgSrc); - if (imgSrc.endsWith('.svg') && !isExternalHref(imgSrc)) { + if (imgSrc.endsWith('.svg') && shouldInlineSvg) { childrenTokens[j] = convertSvg(childrenTokens[j], state, opts); } else { replaceImageSrc(childrenTokens[j], state, opts);