diff --git a/addon/chrome/content/preferences.xhtml b/addon/chrome/content/preferences.xhtml index 7f6e3b6..a1abd73 100644 --- a/addon/chrome/content/preferences.xhtml +++ b/addon/chrome/content/preferences.xhtml @@ -72,6 +72,11 @@ preference="__prefsPrefix__.syncAttachmentFolder" > + + maxLastModifiedPeriod + ) { + return SyncCode.MDAhead; + } else { + return SyncCode.UpToDate; + } } } diff --git a/src/modules/template/preview.ts b/src/modules/template/preview.ts index d5a0440..bae8809 100644 --- a/src/modules/template/preview.ts +++ b/src/modules/template/preview.ts @@ -1,5 +1,6 @@ import YAML = require("yamljs"); import { getNoteLink } from "../../utils/link"; +import { getPref } from "../../utils/prefs"; export { renderTemplatePreview }; @@ -55,6 +56,12 @@ async function renderTemplatePreview( libraryID: data.libraryID, itemKey: data.key, }); + if (getPref("sync.updateTags")) { + const tags = data.getTags(); + if (tags.length) { + header.tags = tags.map((tag) => tag.tag); + } + } html = `${YAML.stringify(header, 10)}`; } } else if (templateName.includes("ExportMDFileContent")) { diff --git a/src/utils/convert.ts b/src/utils/convert.ts index 34932fd..8ad1033 100644 --- a/src/utils/convert.ts +++ b/src/utils/convert.ts @@ -126,6 +126,13 @@ async function note2md( $libraryID: noteItem.libraryID, $itemKey: noteItem.key, }); + if (getPref("sync.updateTags")) { + const tags = noteItem.getTags(); + header.tags = []; + if (tags.length) { + tags.forEach((tag) => header.tags.push(tag.tag)); + } + } const yamlFrontMatter = `---\n${YAML.stringify(header, 10)}\n---`; md = `${yamlFrontMatter}\n${md}`; } @@ -192,7 +199,7 @@ async function link2html( usePosition?: boolean; } = {}, ) { - ztoolkit.log("link2html", link, options); + ztoolkit.log("link2html", link); const linkParams = getNoteLinkParams(link); if (!linkParams.noteItem) { return ""; @@ -1223,7 +1230,7 @@ async function processM2NRehypeImageNodes( src = jointPath(fileDir, src); } if (!(await fileExists(src))) { - ztoolkit.log("parse image, path invalid", src); + ztoolkit.log("parse image, path invalid", src.slice(0, 50)); continue; } } diff --git a/typings/note.d.ts b/typings/note.d.ts index 5ecf81c..9906825 100644 --- a/typings/note.d.ts +++ b/typings/note.d.ts @@ -28,6 +28,7 @@ declare interface MDStatus { $version: number; $libraryID?: number; $itemKey?: string; + tags?: string[]; } | null; content: string; filedir: string;
${YAML.stringify(header, 10)}