UNPKG

@neosjs/vitepress-theme

Version:

NeosJS VitePress theme

16 lines (15 loc) 447 B
import { computed } from "vue"; import { useData } from "./data.mjs"; export function useEditLink() { const { theme, page } = useData(); return computed(() => { const { text = "Edit this page", pattern = "" } = theme.value.editLink || {}; let url; if (typeof pattern === "function") { url = pattern(page.value); } else { url = pattern.replace(/:path/g, page.value.filePath); } return { url, text }; }); }