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

Function convertToLegacyHighlight

src/storage/HighlightDataFormat.ts:46–73  ·  view source on GitHub ↗
(
    id: string,
    highlight: OptimizedHighlight,
    filePath: string
)

Source from the content-addressed store, hash-verified

44 * 转换为旧格式(保持兼容性)
45 */
46export function convertToLegacyHighlight(
47 id: string,
48 highlight: OptimizedHighlight,
49 filePath: string
50): HiNote {
51 return {
52 id,
53 text: highlight.text,
54 position: highlight.position,
55 createdAt: highlight.created,
56 updatedAt: highlight.updated,
57 filePath,
58 backgroundColor: highlight.backgroundColor,
59 blockId: highlight.blockId,
60 isCloze: highlight.isCloze || false,
61 isVirtual: highlight.isVirtual || false,
62 paragraphOffset: highlight.paragraphOffset,
63 contextBefore: highlight.contextBefore,
64 contextAfter: highlight.contextAfter,
65 textFingerprint: highlight.textFingerprint,
66 comments: highlight.comments?.map(comment => ({
67 id: comment.id,
68 content: comment.content,
69 createdAt: comment.created,
70 updatedAt: comment.updated
71 })) || []
72 };
73}
74
75/**
76 * 转换为优化格式

Callers 1

getFileHighlightsMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected