9 lines
402 B
TypeScript
9 lines
402 B
TypeScript
import { isImagePath, workspaceImageLink } from "../workspace/media.ts";
|
|
|
|
export function workspaceFileLink(notePath: string, filePath: string): string {
|
|
const image = workspaceImageLink(notePath, filePath);
|
|
if (isImagePath(filePath)) return image;
|
|
const label = (filePath.replaceAll("\\", "/").split("/").pop() || filePath).replace(/[\\[\]]/g, "\\$&");
|
|
return `[${label}]${image.slice(3)}`;
|
|
}
|