diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 820d5856..216233dd 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -375,8 +375,12 @@ export const findReferences = async ( return foundRefs; }; -export const getFileUrlForMarkdownPreview = (filePath: string): string => - vscode.Uri.file(filePath).toString().replace('file://', ''); +export const getFileUrlForMarkdownPreview = (filePathParam: string): string => { + const workspaceFolder = getWorkspaceFolder(); + const filePath = workspaceFolder ? filePathParam.replace(workspaceFolder, '') : filePathParam; + + return vscode.Uri.file(filePath).toString().replace('file://', ''); +}; export const getImgUrlForMarkdownPreview = (imagePath: string): string => vscode.Uri.file(imagePath).toString().replace('file://', '');