# Template Usage This documentation is for beginners. If you want to customize your own template, see [template doc](./TemplateDoc.md). Post an issue if you need help. You can find templates under the Workspace Tab/Window->Edit:  ## Add a template Click the _Edit Templates_ to open the editor.  Create a blank template, or from a note. Here are example templates for the test: Copy The Name & template text to a new template and save it! **Template Name must include one of these keywords:** ### Custom Templates These templates can have different names. The keyword must be incluede in the template name. - Text: indicate it's a normal template - Note: indicate it's a note template. Must select notes before inserting - Item: indicate it's an item template. Must select items before inserting ### System Templates Only the template with specific name will be called. - QuickInsert: Called when inserting a note link to main note. - QuickBackLink: Called when inserting a note link to main note. The template will be inserted to the end of the sub-note and point to the main note by default. - QuickImport: Called when importing a sub-note to main note. - QuickNote: Called when creating a note from an annotation. - ExportMDFileName: Called when exporting notes to markdown in batch/linked notes to markdown mode. The rendered template will be file name. ## Template Examples Welcome to share & contribute your template! ### [Note] with meta-data ```js
Note: ${link}
${topItem?`Title: ${topItem.getField('title')}
Author: ${topItem.getField('firstCreator')}
Date: ${topItem.getField('date')}
`:''} ``` ### [Item] meta-data ```jsTitle: ${topItem.getField('title')}
Author: ${topItem.getField('firstCreator')}
Date: ${topItem.getField('date')}
``` ### [Item] item-notes with metadata: shared by @zyx335588  ```js|
Title |
${topItem.getField('title')} |
|---|---|
|
Journal |
${topItem.getField('publicationTitle')} |
|
1st Author |
${topItem.getField('firstCreator')} |
|
Authors |
${topItem.getCreators().map((v)=>v.firstName+" "+v.lastName).join("; ")} |
|
Pub. date |
${topItem.getField('date')} |
|
DOI |
${topItem.getField('DOI')} |
|
Archive |
${topItem.getField('archive')} |
|
Archive Location |
${topItem.getField('archiveLocation')} |
|
Call No. |
${topItem.getField('callNumber')} |
${noteItem.getNote()}Merge Date: ${new Date().toISOString().substr(0,10)+" "+ new Date().toTimeString()}
📝 Comments
`; copyNoteImage(noteItem); return noteLine; }).join("\n")} ``` ### [Item] metadata for CS Modified on the previous template. Auto-ajust metadata according to item type.  ```jsMake your comments
|
Title |
${topItem.getField('title')} |
|---|---|
|
${(()=>{ if(topItem.itemType === "conferencePaper") return "Conference"; if(topItem.itemType === "journalArticle") return "Journal"; if(topItem.itemType === "report") return "Publisher"; return "Publisher";})()} |
${(()=>{ if(topItem.itemType === "conferencePaper") { const res = topItem.getField("conferenceName"); return res?res:topItem.getField("proceedingsTitle"); }; if(topItem.itemType === "journalArticle") return topItem.getField("publicationTitle"); if(topItem.itemType === "report") return topItem.getField("institution"); return topItem.getField("publicationTitle");})()} |
|
Authors |
${topItem.getCreators().map((v)=>v.firstName+" "+v.lastName).join("; ")} |
|
Pub. date |
${topItem.getField('date')} |
|
DOI |
${topItem.getField('DOI')} |
|
URL |
${topItem.getField('url')} |
|
CitationKey |
${topItem.citationKey?topItem.citationKey:''} |
Insert more items with meta-data in workspace window->Edit