Tinderbox Training Video 58 - Annotating with Highlights App, Tinderbox, DEVONThink, and Zotero

If by “details” you mean the page number and link to the annotation, you can achieve this by clicking on the annotation and pasting it directly into the map or outline view, rather than into $Text.

The result is the following “challenging” format:

Then, by using the action code I’ve written above (edited, had to correct regex), @ernielmo can get what (I assume) he wants, i.e.,:

I don’t think you can get annotations through Zotero Translators, more feasible way would be to use Zotero API (using runCommand, you would need a Zotero account, API key and parent item ID) and get output to $Text.

1 Like

It looks like simple Markdown (one of Zotero’s two export formats). The problem is that you are assuming a non-Markdown-centric can automatically find the URIs and know where to store them. Bear in mind lots of interacting apps in this space have different notions with respect to ‘URLs’:

  • the pseudo-code link to the RM app’s record
  • the RM app’s stored version of the record (i.e. the paper the record describes)
  • links to annotations to the RM record
  • the URL of the subject reference, e.g. a paper’s DOI, permalink, etc
  • the URL of the PDF or HTML of the reference.
  • … and so on. Certainty only applies without the context of individual apps as there is no common standard.

I made an annotation (Zotero app toolbar ▸ New Item Note) about a paper in Zotero. If I drag it to a view I get the annotation’s name. If I copy/paste it I get nothing (or rather what was already on the clipboard.

I also can’t find zotero:// links anywhere in the Mac app. does this functionality need a plug-in/script/non-default addition to the app?

RIS is definitely putting the publishers page (i.e. their URL of the book/paper/etc) in field UR. The link to the item’s document (PDF, etc.) is placed in filed N1.

This is a bit tangential, but Bryan Jenks does amazing things getting information from Zotero into Obsidian – see this video:

Perhaps something there might be useful. And of course one could potentially get Markdown files from Obsidian into Tinderbox if one wanted.

1 Like

Yes, I agree.

Ah, I misunderstood what was meant by ‘annotation’—I thought it referred to highlighted text in a PDF along with its corresponding comment.

What I meant: Watch CleanShot 2024-12-15 at 22.17.55-converted | Streamable

Apologies for the confusion!!

so I take my words back! :slight_smile:

1 Like

No problem, just trying to help move things forward, despite my limited Zotero experience. :slight_smile:

Zotero annotation md vs HTML.tbx (1.2 MB)
Attached the file here.

Thanks, everyone. I’ll try to explore stamps as I learn the various TB functions.

Just a general observation: if you run into an import situation where (for example) you have some MarkDown text, and Tinderbox does not handle it as you expect, please post it on the forum or email it to tinderbox@eastgate.com . There are lots of special cases out there!

Thanks for the specimen file. This is helpful. Before attempting a parse of the data, I made a few adjustments:

  • I’ve added a new Separator ‘Imports’, to give a sandbox area for triaging Zotero annotations. I’ve moved note “Hypertension - ESC 2004 Supplement” under it. The concept being that in the ‘section’ of the doc you turn ex-Zotero info into finished Tinderbox notes. Once done you’ll move them into the 'References container under the ‘References’ separator. As both those have the same path, /References, this will bite you if you use automation to move finished notes to the container as Tinderbox matches the first item by Outline order, i.e. the separator. Thus I’ve renamed the container ‘Zotero References’ as it better describes what you are putting there and the title/path are unique.

  • Attributes. As $SourceURL is designed for use with DEVONthink and Tinderbox is happy making user attributes, I’ve remove this attribute from the pAnnotation prototype and revised the attributes to $Med_Tag, SubTag, ZLink and ZDocLink. I’ve added descriptions to the latter two (we forget the purpose over time! See grab below). I’m not sure of the purpose of the other two user attributes. A mote Tinderbox-like naming of ‘Med_Tag’ would be ‘MedTag’ but the underscore may have special meaning. If not, I’d use Tinderbox style attribute naming inside Tinderbox.

  • Source data, i.e. the data imported from Zotero. as the data’s still in Zotero, i’ll assume we won’t keep the per-annotation source note once exploded/processed as that info is still stored at source.

I’ll split this replay in several posts (because of length) so I’ll post the revised TBX (as described above) further below.

Now to the source material

Your sample materials tell us Zotero can give us the annotation info in one of three different text/data encodings. Of these, the first is the hardest to use as the link data is ‘flattened’ into the text in a manner hard to retrieve without gnarly regex. The latter two are equally useful as the two zotero:// links have transferred into Tinderbox as web links and been adopted as Tinderbox web links form the RTF $Text. Both are equally good. If you want the source text style you can use the HTML.

As there is no significant use of text styling (bold, strike, underline, etc), I’m going to use the
MD version. At this stage, I think the code to populate $ZLink and $ZDocLink will work for either MD or HTML source versions.

Whilst we could remove the URLs from the text, it’s more effort (lack of any metadata markers) and the anchor text might still be useful.

Once done, the links in $Text and the two Displayed Attributes $ZLink and $ZDocLink will point to the same target. so, the extraction may be moot. But it may be useful to others so let’s do it.

So, we have (correct) links in $Text that we wish to adopt to Tinderbox user attributes. How can action code get at that info? By using eachLink(loopVar[,scope]){actions}, we can check the note’s link(s) and look for Zotero pseudo-protocol links.

Assumption: each annotation will contain zero or one (only) links each of the two link types: the Zotero reference and the reference’s associated local source document.

I’ll wrap the logic up in a fuction, to allow for later re-use oin different contexts:

function fFindZoteroLinks(){
		eachLink(aLink){
			if(aLink["url"].beginsWith("zotero://select")){
				$ZLink = aLink["url"];
			};
			if(aLink["url"].beginsWith("zotero://open-pdf")){
				$ZDocLink = aLink["url"];
			};
		};

	}; //END

And a stamp to call that:

fFindZoteroLinks();

Result:

I’ve got to head out for a meeting, but its a start. Once processed you can automate movement of the note to the ‘Zotero Annotation’ container and delete the source note. Ask if unsure on that (its been discussed in the firum so code should be there somewhere).

TBX, based on yours: Zotero annotation md vs HTML-ed1.tbx (1.3 MB)

Thanks, Mark, for the solution. Worked as intended.

2 Likes