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

Function extractCodeBlockAnchor

web/lib/markdown-render.ts:98–102  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

96 * 无锚点时原样返回。供 PageRenderer 的 code 组件给 `<code>` 赋 id(HashScroller 跳转用)。
97 */
98export function extractCodeBlockAnchor(text: string): { display: string; id?: string } {
99 const m = text.match(CODE_BLOCK_TRAILING_ANCHOR_RE);
100 if (!m || m.index === undefined) return { display: text };
101 return { display: text.slice(0, m.index), id: m[1].replace(/^\^/, "") };
102}
103
104/**
105 * 块级锚点归一化:把表格 / 代码块那些「落在结构分隔符之外、会被 GFM 丢弃或吞内容」的锚点

Callers 3

codeFunction · 0.90
BareCodeFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected