MCPcopy Create free account
hub / github.com/Qinbf/groundmap / parseWikiRef

Function parseWikiRef

tools/debug-console/lib/wiki-ref.ts:108–125  ·  view source on GitHub ↗
(target: string, anchor?: string, alias?: string)

Source from the content-addressed store, hash-verified

106}
107
108export function parseWikiRef(target: string, anchor?: string, alias?: string): WikiRef {
109 let normAnchor: string | null = null;
110 let isBlock = false;
111 if (anchor) {
112 if (anchor.startsWith("^")) {
113 normAnchor = anchor.slice(1);
114 isBlock = true;
115 } else {
116 normAnchor = anchor;
117 }
118 }
119 return {
120 path: normalizeRefPath(target),
121 anchor: normAnchor,
122 isBlock,
123 alias: alias?.trim() || null,
124 };
125}
126
127/** 默认显示文本:alias 优先;没有时用 path#anchor 的精简形 */
128export function refDisplayText(ref: WikiRef): string {

Callers 6

claimContextsForFunction · 0.90
inlineWikiRefsFunction · 0.85
collectRefsFunction · 0.85
downgradeRefAnchorsFunction · 0.85
neutralizeBrokenRefsFunction · 0.85
inlineWikiRefsNumberedFunction · 0.85

Calls 1

normalizeRefPathFunction · 0.85

Tested by

no test coverage detected