Files
RuneStone/src/lib/editor/workspaceFileLink.ts
T
2026-11-16 04:21:21 -07:00

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)}`;
}