MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / resolveMarkdownTarget

Function resolveMarkdownTarget

src/pages/markdownPreview/renderer.js:68–85  ·  view source on GitHub ↗
(target = "", baseUri = "")

Source from the content-addressed store, hash-verified

66}
67
68export function resolveMarkdownTarget(target = "", baseUri = "") {
69 if (!target || target.startsWith("#") || isExternalLink(target)) {
70 return target;
71 }
72
73 const { path, hash } = splitLinkTarget(target);
74 if (!path) return target;
75
76 let resolvedPath = path;
77 if (!path.startsWith("/")) {
78 const baseDir = baseUri ? Url.dirname(baseUri) : "";
79 if (baseDir) {
80 resolvedPath = Url.join(baseDir, path);
81 }
82 }
83
84 return `${resolvedPath}${hash}`;
85}
86
87function resolveImageTarget(target = "", baseUri = "") {
88 if (

Callers 3

resolveRenderedImagesFunction · 0.90
onContentClickFunction · 0.90
renderMarkdownFunction · 0.85

Calls 2

isExternalLinkFunction · 0.85
splitLinkTargetFunction · 0.85

Tested by

no test coverage detected