Basic template for tagged highlights when creating a child note from annotation

edited 4 days ago
Hi, just to share here a very basic template to add the tags to the highlights you tagged (only if you did so) when creating a child note from annotations.

Example : let say you highlighted "e=mc2" and used the tags #definition and #equation. And let say you want a result just as similar as the template in Zotero documentation for conditional blockquote, just the tags in addition.

See the first code line in the "Conditionnal" section in
<blockquote>{{highlight}}</blockquote><p>{{citation}}</p>{{if comment}}<p>{{comment}}</p>{{endif}}

Add the tag part below:
{{if tags}}<p>#{{tags : tags join=' #'}}</p>{{endif}}
Note the '#' at the beginning of the paragraph, and the space before the # in the tags join part.

The full template copy-paste ready:
<blockquote>{{highlight}}</blockquote><p>{{citation}}</p>{{if comment}}<p>{{comment}}</p>{{endif}}{{if tags}}<p>#{{tags : tags join=' #'}}</p>{{endif}}
Insert it in the annotations.noteTemplates.highlight in the associated preference field, see documentation if in doubt.

Hope it works for you

Some posible integration with obsidian: make obsidian recognize all your tags #.
You can also set the above with '#_hgh_' to get sort of a nested tag behavior in your obsidian tagging system. In the example above #_hgh_definition and #_hgh_equation. Edit: Actually, you could use obsidian nested tag syntax directly with '/'. Just write #hgh/in the tag part above. Or copy it from here {{if tags}}<p>#hgh/{{tags : tags join=' #hgh/'}}</p>{{endif}}

Edit2: you may want to do the same for the note you add (post-it without highlight). Then go to annotation.notesTemplates.note (instead of .highlight) and add the same tag part suffix. For the obsidian nested syntax #hgh/ above, here is the full preference : <p>{{citation}} {{comment}}</p>{{if tags}}<p>#hgh/{{tags : tags join=' #hgh/'}}</p>{{endif}}
You can see there is no blockquote here, but set it up as you wish.

This waiting for the coming features from Zotero that should enable us to search for tags in our highlights from the advanced search pane, if I am correct.
Sign In or Register to comment.