diff --git a/package.json b/package.json index 85f0193..71f3fbc 100644 --- a/package.json +++ b/package.json @@ -188,10 +188,10 @@ "default": false, "description": "Suppress warnings." }, - "texinfo.preview.displayImage": { + "texinfo.preview.localImage": { "type": "boolean", "default": false, - "description": "Display images in in preview." + "description": "Display local images in in preview." }, "texinfo.preview.customCSS": { "type": "string", diff --git a/src/contexts/preview.ts b/src/contexts/preview.ts index 11d84cd..e27915b 100644 --- a/src/contexts/preview.ts +++ b/src/contexts/preview.ts @@ -79,9 +79,11 @@ export default class PreviewContext { private pendingUpdate = false; private get imageTransformer(): Optional> { - if (!Options.displayImage) return undefined; + if (!Options.localImage) return undefined; const pathName = path.dirname(this.document.fileName); return src => { + // Do not transform URIs of online images. + if (src.startsWith('https://') || src.startsWith('http://')) return src; const srcUri = vscode.Uri.file(pathName + '/' + src); // To display images in webviews, image URIs in HTML should be converted to VSCode-recognizable ones. return this.panel.webview.asWebviewUri(srcUri).toString(); diff --git a/src/options.ts b/src/options.ts index 77d7cb3..23b8037 100644 --- a/src/options.ts +++ b/src/options.ts @@ -70,8 +70,8 @@ export default class Options implements vscode.Disposable { return Options.instance.getBoolean('preview.noWarnings'); } - static get displayImage() { - return Options.instance.getBoolean('preview.displayImage'); + static get localImage() { + return Options.instance.getBoolean('preview.localImage'); } static get customCSS() {