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

Method exportHighlightsToNote

src/services/ExportService.ts:111–127  ·  view source on GitHub ↗

* 导出文件的高亮和评论内容为新的笔记 * @param sourceFile 源文件 * @returns 返回创建的新文件

(sourceFile: TFile)

Source from the content-addressed store, hash-verified

109 * @returns 返回创建的新文件
110 */
111 async exportHighlightsToNote(sourceFile: TFile): Promise<TFile> {
112 // 获取文件的所有高亮和评论
113 const highlights = await this.getFileHighlights(sourceFile);
114 if (!highlights || highlights.length === 0) {
115 throw new Error(t("No highlights found in the current file."));
116 }
117
118 // 生成导出内容
119 const content = await this.generateExportContent(sourceFile, highlights);
120
121 // 获取导出路径并创建文件
122 const settings = this.getPluginSettings();
123 const exportPath = settings?.export?.exportPath || '';
124 const fileName = `${sourceFile.basename} - HiNote ${window.moment().format("YYYYMMDDHHmmss")}`;
125
126 return await this.createExportFile(fileName, content, exportPath);
127 }
128
129 /**
130 * 获取文件的所有高亮和评论

Callers 1

handleExportClickMethod · 0.80

Calls 5

getFileHighlightsMethod · 0.95
generateExportContentMethod · 0.95
getPluginSettingsMethod · 0.95
createExportFileMethod · 0.95
tFunction · 0.90

Tested by

no test coverage detected