-
-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Documentation] Note Templates from Community #85
Comments
Template: Text[Text] today<h1>TODO: ${new Date().toLocaleDateString()}</h1>
<h2>Tasks</h2>
<ul>
<li>
Read Paper 1
</li>
<li>
Do some experiments
</li>
</ul>
<blockquote>
<p>Insert more items with meta-data in workspace window->Edit</p>
</blockquote>
<p></p>
<h2>Done Tasks</h2>
<p></p>
<h2>Todo Tomorrow</h2>
<p></p>
</div> [Text] TableSee https://github.com/windingwind/zotero-better-notes/blob/master/TemplateDoc.md#table ${(()=>{
const size = prompt("Table Size(row*column):", "4*3");
if(!size){
return "";
}
const row = Number(size.split("*")[0]);
const col = Number(size.split("*")[1]);
if(!row || !col){
return "";
}
const makeCell = ()=>"<td>\n</td>";
const makeRow = ()=>`<tr>${[...Array(col).keys()].map(makeCell).join("\n")}</tr>`;
return `<table>
${[...Array(row).keys()].map(makeRow).join("\n")}
</table>`;
})()} |
Template: Item(metadata)[Item] metadataShow Template Code<h2>Item Meta Data:</h2>
<p>Title: ${topItem.getField('title')}</p>
<p>Author: ${topItem.getField('firstCreator')}</p>
<p>Date: ${topItem.getField('date')}</p> [Item] item-notes with metadata:Author: @zyx335588 Show Template Code<h1>${topItem.getField('title')}</h1>
<h2 style="color:red; background-color: #efe3da;">💡 Meta Data</h2>
<table>
<tr>
<th style="background-color:#dbeedd;">
<p style="text-align: right">Title </p>
</th>
<td style="background-color:#dbeedd;">
<p>${topItem.getField('title')}</p>
</td>
</tr>
<tr>
<th style="background-color:#f3faf4;">
<p style="text-align: right">Journal </p>
</th>
<td style="background-color:#f3faf4;">
<p>${topItem.getField('publicationTitle')}</p>
</td>
</tr>
<tr>
<th style="background-color:#dbeedd;">
<p style="text-align: right">1<sup>st</sup> Author </p>
</th>
<td style="background-color:#dbeedd;">
<p>${topItem.getField('firstCreator')}</p>
</td>
</tr>
<tr>
<th style="background-color:#f3faf4;">
<p style="text-align: right">Authors </p>
</th>
<td style="background-color:#f3faf4;">
<p>${topItem.getCreators().map((v)=>v.firstName+" "+v.lastName).join("; ")}</p>
</td>
</tr>
<tr>
<th style="background-color:#dbeedd;">
<p style="text-align: right">Pub. date </p>
</th>
<td style="background-color:#dbeedd;">
<p>${topItem.getField('date')}</p>
</td>
</tr>
<tr>
<th style="background-color:#f3faf4;">
<p style="text-align: right">DOI </p>
</th>
<td style="background-color:#f3faf4;">
<a href="https://doi.org/${topItem.getField('DOI')}">${topItem.getField('DOI')}</a>
</td>
</tr>
<tr>
<th style="background-color:#dbeedd;">
<p style="text-align: right">Archive </p>
</th>
<td style="background-color:#dbeedd;">
<p>${topItem.getField('archive')}</p>
</td>
</tr>
<tr>
<th style="background-color:#f3faf4;">
<p style="text-align: right">Archive Location </p>
</th>
<td style="background-color:#f3faf4;">
<p>${topItem.getField('archiveLocation')}</p>
</td>
</tr>
<tr>
<th style="background-color:#dbeedd;">
<p style="text-align: right">Call No. </p>
</th>
<td style="background-color:#dbeedd;">
<p>${topItem.getField('callNumber')}</p>
</td>
</tr>
</table>
${itemNotes.map((noteItem)=>{
const noteLine = `<h2 style="color:red; background-color: #efe3da;">📜 Note: <a href="${Zotero.Knowledge4Zotero.knowledge.getNoteLink(noteItem)
}" rel="noopener noreferrer nofollow">${noteItem.key}</a></h2>
<blockquote>
${noteItem.getNote()}
<p style="background-color: pink;"><strong>Merge Date: </strong> ${new Date().toISOString().substr(0,10)+" "+ new Date().toTimeString()}</p>
</blockquote>
<p style="color:red; background-color: #efe3da;"><strong>📝 Comments</strong></p>
<blockquote>
<p>Make your comments</p>
<p></p>
</blockquote>`;
copyNoteImage(noteItem);
return noteLine;
}).join("\n")} [Item] metadata for CSModified on the previous template. Auto-adjust metadata according to item type. Show Template Code<h2>${topItem.getField('title')}</h2>
<table>
<tr>
<th style="background-color:#dbeedd;">
<p style="text-align: right">Title </p>
</th>
<td style="background-color:#dbeedd;">
<p>${topItem.getField('title')}</p>
</td>
</tr>
<tr>
<th style="background-color:#f3faf4;">
<p style="text-align: right">${(()=>{
if(topItem.itemType === "conferencePaper") return "Conference";
if(topItem.itemType === "journalArticle") return "Journal";
if(topItem.itemType === "report") return "Publisher";
return "Publisher";})()}</p>
</th>
<td style="background-color:#f3faf4;"><p>${(()=>{
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");})()}</p>
</td>
</tr>
<tr>
<th style="background-color:#dbeedd;">
<p style="text-align: right">Authors </p>
</th>
<td style="background-color:#dbeedd;">
<p>${topItem.getCreators().map((v)=>v.firstName+" "+v.lastName).join("; ")}</p>
</td>
</tr>
<tr>
<th style="background-color:#f3faf4;">
<p style="text-align: right">Pub. date </p>
</th>
<td style="background-color:#f3faf4;">
<p>${topItem.getField('date')}</p>
</td>
</tr>
<tr>
<th style="background-color:#dbeedd;">
<p style="text-align: right">DOI </p>
</th>
<td style="background-color:#dbeedd;">
<a href="https://doi.org/${topItem.getField('DOI')}">${topItem.getField('DOI')}</a>
</td>
</tr>
<tr>
<th style="background-color:#f3faf4;">
<p style="text-align: right">URL</p>
</th>
<td style="background-color:#f3faf4;">
<p>${topItem.getField('url')}</p>
</td>
</tr>
<tr>
<th style="background-color:#dbeedd;">
<p style="text-align: right">CitationKey</p>
</th>
<td style="background-color:#dbeedd;">
<p>${topItem.citationKey?topItem.citationKey:''}</p>
</td>
</tr>
</table> Extra Metadata Fields: Item Link. Click to open the PDF attachment. Show Template Code <tr>
<th style="background-color:#f3faf4;">
<p style="text-align: right">PDF Attachment</p>
</th>
<td style="background-color:#f3faf4;">
<p>${((topItem) => {
const getPDFLink = (_item) => {
let libraryID = _item.libraryID;
let library = Zotero.Libraries.get(libraryID);
let itemKey = _item.key;
let itemLink = "";
if (library.libraryType === "user") {
itemLink = `zotero://open-pdf/library/items/${itemKey}`;
} else if (library.libraryType === "group") {
itemLink = `zotero://open-pdf/groups/${library.id}/items/${itemKey}`;
}
return `<a href="${itemLink}">${_item.getFilename()}</a>`;
};
return Zotero.Items.get(topItem.getAttachments())
.filter((i) => i.isPDFAttachment())
.map((i) => getPDFLink(i))
.join("\n");
})(topItem)
}</p>
</td>
</tr> [Item] item-notes with item¬e metadataAuthor: @pyfriday Show Template Code<h2 style="color:red; background-color: #efe3da;">📜 Note: ${link}</a></h2>
<blockquote>
${noteItem.getNote()}
<p style="background-color: pink;"><strong>Merge Date: </strong> ${new Date().toISOString().substr(0,10)+" "+ new Date().toTimeString()}</p>
${topItem? `<h3 style="color:red; background-color: #efe3da;">💡 Meta Data</h3>
<blockquote>
<table>
<tr>
<th style="background-color:#dbeedd;">
<p style="text-align: right">Title </p>
</th>
<td style="background-color:#dbeedd;">
<p>${topItem.getField('title')}</p>
</td>
</tr>
<tr>
<th style="background-color:#f3faf4;">
<p style="text-align: right">Journal </p>
</th>
<td style="background-color:#f3faf4;">
<p>${topItem.getField('publicationTitle')}</p>
</td>
</tr>
<tr>
<th style="background-color:#f3faf4;">
<p style="text-align: right">Authors </p>
</th>
<td style="background-color:#f3faf4;">
<p>${topItem.getCreators().map((v)=>v.firstName+" "+v.lastName).join("; ")}</p>
</td>
</tr>
<tr>
<th style="background-color:#dbeedd;">
<p style="text-align: right">Pub. date </p>
</th>
<td style="background-color:#dbeedd;">
<p>${topItem.getField('date')}</p>
</td>
</tr>
<tr>
<th style="background-color:#dbeedd;">
<p style="text-align: right">IF </p>
</th>
<td style="background-color:#dbeedd;">
<p>${topItem.getField('callNumber')}</p>
</td>
</tr>
</table>
</blockquote>
</blockquote>
<p style="color:red; background-color: #efe3da;"><strong>📝 Comments</strong></p>
<blockquote>
<p>Make your comments</p>
<p></p>
</blockquote>` : ""} |
Template: Item(annotations by color)[Item] collect annotations by colorAuthor: @windingwind Show Template Code${await new Promise(async (r) => {
async function getAnnotation(item) {
try {
if (!item || !item.isAnnotation()) {
return null;
}
let json = await Zotero.Annotations.toJSON(item);
json.id = item.key;
delete json.key;
for (let key in json) {
json[key] = json[key] || "";
}
json.tags = json.tags || [];
return json;
} catch (e) {
Zotero.logError(e);
return null;
}
}
async function getAnnotationsByColor(_item, colorFilter) {
const annots = _item.getAnnotations().filter(colorFilter);
if (annots.length === 0) {
return {
html: "",
};
}
let annotations = [];
for (let annot of annots) {
const annotJson = await getAnnotation(annot);
annotJson.attachmentItemID = _item.id;
annotations.push(annotJson);
}
if (!editor) {
alert("No active note editor detected. Please open workspace.");
return r("");
}
await editor.importImages(annotations);
return Zotero.EditorInstanceUtilities.serializeAnnotations(annotations);
}
const attachments = Zotero.Items.get(topItem.getAttachments()).filter((i) =>
i.isPDFAttachment()
);
let res = "";
const colors = ["#ffd400", "#ff6666", "#5fb236", "#2ea8e5", "#a28ae5"];
const colorNames = ["Yellow", "Red", "Green", "Blue", "Purple"];
for (let attachment of attachments) {
res += `<h1>${attachment.getFilename()}</h1>`;
for (let i in colors) {
const renderedAnnotations = (
await getAnnotationsByColor(
attachment,
(_annot) => _annot.annotationColor === colors[i]
)
).html;
if (renderedAnnotations) {
res += `<h2><p style="background-color:${colors[i]};">${colorNames[i]} Annotations</p></h2>\n${renderedAnnotations}`;
}
}
const renderedAnnotations = (
await getAnnotationsByColor(
attachment,
(_annot) => !colors.includes(_annot.annotationColor)
)
).html;
if (renderedAnnotations) {
res += `<h2><p>Other Annotations</p></h2>\n${renderedAnnotations}`;
}
}
r(res);
})} [Item] collect annotations by colorAuthor: @windingwind Show Template Code${await new Promise(async (r) => {
async function getAnnotation(item) {
try {
if (!item || !item.isAnnotation()) {
return null;
}
let json = await Zotero.Annotations.toJSON(item);
json.id = item.key;
delete json.key;
for (let key in json) {
json[key] = json[key] || "";
}
json.tags = json.tags || [];
return json;
} catch (e) {
Zotero.logError(e);
return null;
}
}
async function getAnnotationsByColor(_item, color) {
let annots = _item
.getAnnotations()
annots = color ?
annots.filter((_annot) => _annot.annotationColor === color) :
annots;
let annotations = [];
for (let annot of annots) {
const annotJson = await getAnnotation(annot);
annotJson.attachmentItemID = _item.id;
annotations.push(annotJson);
}
if (!editor) {
alert("No active note editor detected. Please open workspace.");
return r("");
}
await editor.importImages(annotations);
return Zotero.EditorInstanceUtilities.serializeAnnotations(annotations);
}
const attachments = Zotero.Items.get(topItem.getAttachments()).filter((i) =>
i.isPDFAttachment()
);
let res = "";
for (let attachment of attachments) {
res += `<h2>${attachment.getFilename()}</h2>
${(await getAnnotationsByColor(attachment)).html}`;
}
r(res);
})} |
Template: Item(notes)[Item] collect item-notes to a new item-note and add a link to the main noteAuthor: @windingwind ${await new Promise(async (r) => {
const newNote = new Zotero.Item("note");
newNote.libraryID = topItem.libraryID;
newNote.parentID = topItem.id;
newNote.setNote(
`<div data-schema-version="8">
<h2>${topItem.getField('title')}</h2>
${Zotero.Items.get(item.getNotes()).map(_note => `<p>
<a href="${Zotero.Knowledge4Zotero.knowledge.getNoteLink(_note)}">
${_note.getNoteTitle()}
</a>
</p>`).join('\n')}
</div>`
);
await newNote.saveTx();
let res = `<p>
<a href="${Zotero.Knowledge4Zotero.knowledge.getNoteLink(newNote)}">
${newNote.getNoteTitle()}
</a>
</p>`;
r(res);
})} |
Template: Item(annotations by tag)
Usage: Select some items, input tags(split by [Item] collect annotations by tagAuthor: @windingwind
Show Template Code// @beforeloop-begin
${(()=>{
sharedObj.tagRaw = prompt("Please input tags. Split with ',':", "");
return "";
})()}
// @beforeloop-end
// @default-begin
${await new Promise(async (r) => {
async function getAnnotation(item) {
try {
if (!item || !item.isAnnotation()) {
return null;
}
let json = await Zotero.Annotations.toJSON(item);
json.id = item.key;
delete json.key;
for (let key in json) {
json[key] = json[key] || "";
}
json.tags = json.tags || [];
return json;
} catch (e) {
Zotero.logError(e);
return null;
}
}
async function getAnnotationsByTag(_item, tag) {
let annots = _item.getAnnotations();
annots = tag.length?
annots.filter((_annot) => _annot.getTags().map(_t=>_t.tag).includes(tag)) :
annots;
let annotations = [];
for (let annot of annots) {
const annotJson = await getAnnotation(annot);
annotJson.attachmentItemID = _item.id;
annotations.push(annotJson);
}
if (!editor) {
alert("No active note editor detected. Please open workspace.");
return r("");
}
await editor.importImages(annotations);
return Zotero.EditorInstanceUtilities.serializeAnnotations(annotations);
}
const attachments = Zotero.Items.get(topItem.getAttachments()).filter((i) =>
i.isPDFAttachment()
);
let res = "";
if(!sharedObj.tagRaw){
return;
}
res += `<h1>${topItem.getField('title')}</h1>`;
for (let attachment of attachments) {
res += `<h2>${attachment.getFilename()}</h2>`;
for(tag of sharedObj.tagRaw.split(',').filter(t=>t.length)){
res += `<h3>Tag: ${tag}</h3>`;
const tags = (await getAnnotationsByTag(attachment, tag)).html
res += tags ? tags : "<p>No result</p>";
}
}
r(res);
})}
// @default-end [Item] collect annotations by tag separatelyAuthor: @windingwind
Show Template Code// @default-begin
${await new Promise(async (r) => {
async function getAnnotation(item) {
try {
if (!item || !item.isAnnotation()) {
return null;
}
let json = await Zotero.Annotations.toJSON(item);
json.id = item.key;
delete json.key;
for (let key in json) {
json[key] = json[key] || "";
}
json.tags = json.tags || [];
return json;
} catch (e) {
Zotero.logError(e);
return null;
}
}
async function getAnnotationsByTag(_item, tag) {
let annots = _item.getAnnotations();
annots = tag.length?
annots.filter((_annot) => _annot.getTags().map(_t=>_t.tag).includes(tag)) :
annots;
let annotations = [];
for (let annot of annots) {
const annotJson = await getAnnotation(annot);
annotJson.attachmentItemID = _item.id;
annotations.push(annotJson);
}
if (!editor) {
alert("No active note editor detected. Please open workspace.");
return r("");
}
await editor.importImages(annotations);
return Zotero.EditorInstanceUtilities.serializeAnnotations(annotations);
}
const attachments = Zotero.Items.get(topItem.getAttachments()).filter((i) =>
i.isPDFAttachment()
);
let res = "";
const tagRaw = prompt(`Source: ${topItem.getField('title')}
Please input tags. Split with ',':`, "");
if(!tagRaw){
return;
}
res += `<h1>${topItem.getField('title')}</h1>`;
for (let attachment of attachments) {
res += `<h2>${attachment.getFilename()}</h2>`;
for(tag of tagRaw.split(',').filter(t=>t.length)){
res += `<h3>Tag: ${tag}</h3>`;
const tags = (await getAnnotationsByTag(attachment, tag)).html
res += tags ? tags : "<p>No result</p>";
}
}
r(res);
})}
// @default-end [Item] collect annotations and notes by tagAuthor: @windingwind
Show Template Code// @beforeloop-begin
${(()=>{
sharedObj.tagRaw = prompt("Please input tags. Split with ',':", "");
return "";
})()}
// @beforeloop-end
// @default-begin
${await new Promise(async (r) => {
async function getAnnotation(item) {
try {
if (!item || !item.isAnnotation()) {
return null;
}
let json = await Zotero.Annotations.toJSON(item);
json.id = item.key;
delete json.key;
for (let key in json) {
json[key] = json[key] || "";
}
json.tags = json.tags || [];
return json;
} catch (e) {
Zotero.logError(e);
return null;
}
}
async function getAnnotationsByTag(_item, tag) {
let annots = _item.getAnnotations();
annots = tag.length?
annots.filter((_annot) => _annot.getTags().map(_t=>_t.tag).includes(tag)) :
annots;
let annotations = [];
for (let annot of annots) {
const annotJson = await getAnnotation(annot);
annotJson.attachmentItemID = _item.id;
annotations.push(annotJson);
}
if (!editor) {
alert("No active note editor detected. Please open workspace.");
return r("");
}
await editor.importImages(annotations);
return Zotero.EditorInstanceUtilities.serializeAnnotations(annotations);
}
const attachments = Zotero.Items.get(topItem.getAttachments()).filter((i) =>
i.isPDFAttachment()
);
let res = "";
if(!sharedObj.tagRaw){
return;
}
res += `<h1>${topItem.getField('title')}</h1>`;
for (let attachment of attachments) {
res += `<h2>${attachment.getFilename()}</h2>`;
for(tag of sharedObj.tagRaw.split(',').filter(t=>t.length)){
res += `<h3>Tag: ${tag}</h3>`;
const tags = (await getAnnotationsByTag(attachment, tag)).html
res += tags ? tags : "<p>No result</p>";
}
}
res += `<h2>Notes</h2>`;
const notesWithTags = `${itemNotes.filter(noteItem=>{
for(tag of sharedObj.tagRaw.split(',').filter(t=>t.length)){
if(noteItem.getTags().map(_t=>_t.tag).includes(tag)){
return true;
}
}
return false;
}).map((noteItem)=>{
const noteLine = `<p style="color:red; background-color: #efe3da;">📜 Article Note: <a href="${Zotero.Knowledge4Zotero.knowledge.getNoteLink(noteItem)
}" rel="noopener noreferrer nofollow">${noteItem.getNoteTitle()?noteItem.getNoteTitle():Zotero.Knowledge4Zotero.knowledge.getNoteLink(noteItem)}</a></p>
<p>tags: ${noteItem.getTags().map(_t=>_t.tag).join(', ')}</p>
<p> </p>`;
return noteLine;
}).join("\n")}`
res += notesWithTags ? notesWithTags : '<p>No result</p>'
r(res);
})}
// @default-end [Item] collect item-notes by tagAuthor: @windingwind
Show Template Code// @beforeloop-begin
${(()=>{
sharedObj.tagRaw = prompt("Please input tags. Split with ',':", "");
return "";
})()}
// @beforeloop-end
// @default-begin
${await new Promise(async (r) => {
let res = "";
if(!sharedObj.tagRaw){
return;
}
res += `<h1>${topItem.getField('title')}</h1>`;
res += `<h2>Notes</h2>`;
const notesWithTags = `${itemNotes.filter(noteItem=>{
for(tag of sharedObj.tagRaw.split(',').filter(t=>t.length)){
if(noteItem.getTags().map(_t=>_t.tag).includes(tag)){
return true;
}
}
return false;
}).map((noteItem)=>{
const noteLine = `<p style="color:red; background-color: #efe3da;">📜 Article Note: <a href="${Zotero.Knowledge4Zotero.knowledge.getNoteLink(noteItem)
}" rel="noopener noreferrer nofollow">${noteItem.getNoteTitle()?noteItem.getNoteTitle():Zotero.Knowledge4Zotero.knowledge.getNoteLink(noteItem)}</a></p>
<p>tags: ${noteItem.getTags().map(_t=>_t.tag).join(', ')}</p>
<p> </p>`;
return noteLine;
}).join("\n")}`
res += notesWithTags ? notesWithTags : '<p>No result</p>'
r(res);
})}
// @default-end [Item] collect item-notes by tag seperatelyAuthor: @windingwind
Show Template Code// @default-begin
${await new Promise(async (r) => {
let res = "";
let tagRaw = prompt("Please input tags. Split with ',':", "");
if(!tagRaw){
return;
}
res += `<h1>${topItem.getField('title')}</h1>`;
res += `<h2>Notes</h2>`;
const notesWithTags = `${itemNotes.filter(noteItem=>{
for(tag of sharedObj.tagRaw.split(',').filter(t=>t.length)){
if(noteItem.getTags().map(_t=>_t.tag).includes(tag)){
return true;
}
}
return false;
}).map((noteItem)=>{
const noteLine = `<p style="color:red; background-color: #efe3da;">📜 Article Note: <a href="${Zotero.Knowledge4Zotero.knowledge.getNoteLink(noteItem)
}" rel="noopener noreferrer nofollow">${noteItem.getNoteTitle()?noteItem.getNoteTitle():Zotero.Knowledge4Zotero.knowledge.getNoteLink(noteItem)}</a></p>
<p>tags: ${noteItem.getTags().map(_t=>_t.tag).join(', ')}</p>
<p> </p>`;
return noteLine;
}).join("\n")}`
res += notesWithTags ? notesWithTags : '<p>No result</p>'
r(res);
})}
// @default-end [Item] all annotations and notes by tagAuthor: @windingwind
Show Template Code// @beforeloop-begin
${(() => {
sharedObj.tagsDict = {};
sharedObj.updateData = (item, tag) => {
if (!(tag in sharedObj.tagsDict)) {
sharedObj.tagsDict[tag] = [];
}
sharedObj.tagsDict[tag].push(item);
};
if (!editor) {
alert("No active note editor detected. Please open workspace.");
sharedObj.error = true;
}
return "";
})()}
// @beforeloop-end
// @default-begin
${await new Promise(async (r) => {
if (sharedObj.error) {
return;
}
if (topItem.isRegularItem()) {
const annotations = [];
const attachments = Zotero.Items.get(topItem.getAttachments()).filter((i) =>
i.isPDFAttachment()
);
attachments.forEach((i) => {
annotations.splice(0, 0, ...i.getAnnotations());
});
const notes = Zotero.Items.get(topItem.getNotes());
annotations.splice(0, 0, ...notes);
annotations.forEach((annotation) =>
annotation
.getTags()
.map((tag) => tag.tag)
.forEach((tag) => {
sharedObj.updateData(annotation, tag);
})
);
Zotero.Items.get(topItem.getNotes()).forEach((note) =>
note
.getTags()
.map((tag) => tag.tag)
.forEach((tag) => {
sharedObj.updateData(note, tag);
})
);
} else if (topItem.isNote()) {
topItem
.getTags()
.map((tag) => tag.tag)
.forEach((tag) => {
sharedObj.updateData(topItem, tag);
});
}
return r("");
})}
// @default-end
// @afterloop-begin
${await new Promise(async (r) => {
if (sharedObj.error) {
return;
}
console.log(sharedObj);
let res = "";
for (const tag in sharedObj.tagsDict) {
res += `<h1>Tag: ${tag}</h1>\n`;
for (const note of sharedObj.tagsDict[tag].filter((item) =>
item.isNote()
)) {
res += `<p><a href="${Zotero.Knowledge4Zotero.knowledge.getNoteLink(
note
)}">${note.getNoteTitle()}</a></p>\n`;
}
res += await Zotero.Knowledge4Zotero.NoteParse.parseAnnotationHTML(
editor._item,
sharedObj.tagsDict[tag].filter((item) => item.isAnnotation())
);
res += "\n";
}
return r(res);
})}
// @afterloop-end |
Template: QuickNoteV2Usage: Create note from annotation. [QuickNoteV2] ${await new Promise(async (r) => {
let res = "annotation"
if(annotationItem.annotationComment){
res = ""
res += Zotero.Knowledge4Zotero.parse.parseMDToHTML(annotationItem.annotationComment);
}
res +="<blockquote><i>《"
res +=topItem.getField('title')
res += "》</i></blockquote>"
res += await
Zotero.Knowledge4Zotero.parse.parseAnnotationHTML(noteItem, [annotationItem], true);
r(res);})} |
Template: Item(notes)[Item] note linksInsert links of selected notes. <p><a href="${Zotero.Knowledge4Zotero.knowledge.getNoteLink(topItem)}">${topItem.getNoteTitle().trim() ? topItem.getNoteTitle().trim() : Zotero.Knowledge4Zotero.knowledge.getNoteLink(topItem)}</a></p> |
Please see https://github.com/windingwind/zotero-better-notes/discussions/categories/note-templates
The text was updated successfully, but these errors were encountered: