MCPcopy Create free account
hub / github.com/CatMuse/HiNote / generateHighlightId

Method generateHighlightId

src/utils/IdGenerator.ts:14–19  ·  view source on GitHub ↗

* 生成高亮ID * 基于文件路径、位置和文本内容生成稳定的ID * @param filePath 文件路径 * @param position 位置 * @param text 高亮文本 * @returns 稳定的高亮ID

(filePath: string, position: number, text: string)

Source from the content-addressed store, hash-verified

12 * @returns 稳定的高亮ID
13 */
14 static generateHighlightId(filePath: string, position: number, text: string): string {
15 // 使用文件路径、位置和文本内容生成稳定的哈希
16 const content = `${filePath}:${position}:${text}`;
17 const hash = this.hashCode(content);
18 return `highlight-${Math.abs(hash)}-${position}`;
19 }
20
21 /**
22 * 生成批注ID

Callers 4

createFlashcardMethod · 0.80
addHighlightMethod · 0.80
processRegexMatchesMethod · 0.80
addCommentMethod · 0.80

Calls 1

hashCodeMethod · 0.95

Tested by

no test coverage detected