You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I would like to create a note template that only extracts comments from a pdf in zotero but not highlights.
How can I in a template:
Type some markdown/html
Have a header called Annotations
Have there all comments made in the document, but not the highlights
Specifically:
// @author [](url)
// @link [](url)
// Metadata, title etc.
<!-- Title -->
<h1 > ${topItem.getField('citationKey')} ${topItem.getField("title")} </h1>
// ..
// ..
<h2> Annotations </h2>
${{
// Get attachments
const attachments = Zotero.Items.get(topItem.getAttachments() || []);
if (!attachments || attachments.length === 0) return 'No attachments';
// Call getAnnotations() for each attachment
const annArrays = await Promise.all(attachments.map(async (att) => {
try {
const maybe = att.getAnnotations();
return await Promise.resolve(maybe);
} catch (err) {
return [];
}
}));
// Flatten and filter only comment annotations
const allAnns = annArrays.flat().filter(a => a && a.annotationComment && a.annotationComment.trim());
if (!allAnns.length) return 'No annotations';
// Convert
return await Zotero.BetterNotes.api.convert.annotations2html(allAnns);
}}$
In the coding part, annotationComment includes both the highlighted text and the comment, but I am only interested in returning the comment. How can that be done?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I would like to create a note template that only extracts comments from a pdf in zotero but not highlights.
How can I in a template:
Specifically:
In the coding part, annotationComment includes both the highlighted text and the comment, but I am only interested in returning the comment. How can that be done?
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions