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

edited May 14, 2022
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.188BET靠谱吗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 188BET靠谱吗//www.brodersterzo.com/support/note_templates
{{highlight}}

{{citation}}

{{if comment}}

{{comment}}

{{endif}}


Add the tag part below:
{{if tags}}

#{{tags : tags join=' #'}}

{{endif}}

Note the '//www.brodersterzo.com/forums/discussion/97185/#' at the beginning of the paragraph, and the space before the # in the tags join part.

The full template copy-paste ready:
{{highlight}}

{{citation}}

{{if comment}}

{{comment}}

{{endif}}{{if tags}}

#{{tags : tags join=' #'}}

{{endif}}

Insert it in the annotations.noteTemplates.highlight in the associated preference field, see documentation if in doubt.

Hope it works for you

Extra
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}}

#hgh/{{tags : tags join=' #hgh/'}}

{{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 :

{{citation}} {{comment}}

{{if tags}}

#hgh/{{tags : tags join=' #hgh/'}}

{{endif}}

You can see there is no blockquote here, but set it up as you wish.

188BET靠谱吗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.
  • I was looking for something like this & my first relevant search showed me this other thread 188BET靠谱吗https://forums.zotero.org/discussion/95600/adding-annotation-tags-to-notes#latest

    I shared my template on that other thread.Thought I'd connect the two here.
  • Hey that's very nice, thank you oddlyaware.

    Update from may (2 months from now), I still do not use so much of obsidian in my workflow, though I am still working on doing monthly reports of my all notes (single and child) and make it searchable.

    I created collections of such notes through saved advanced search...but got lazy with actually doing the export.

    Was considering using simple macro from windows 10 to run on weekly, monthly, quarterly schedule.But it needs some set up from obsidian side and for now I can live without it.Plus I would need to know how to set up such macro commands...

    Will send pic if and when anything new.

    Last note: I was also considering some even simpler workflow with libreoffice and the index feature, but sadly (and for serious technical reason) libreoffice cannot provide a clickable index, which is one of the expected results I am looking for.Timeline plugin from obsidian is also nice but too complex for me now.

    Last last, I tried a workflow by creating a dummy-like parent item that take the title of the essay/project I am working on, and then add notes as child item.It may sound stupid but respecting the minimizing clic criteria when doing things with computers, I do not need to switch to other app, either be obsidian or libreoffice, so worth the trying.

  • edited August 19, 2022
    Hello alflamingo,
    thank you very much for posting this interesting code here.I would like to add this kind of functionality to my workflow.
    I have been working on some code for the Note Template in order to then further process the extracted pdf highlights in Obsidian.I am currently using some conditional statements depending on the highlight color and would love to add additional tag functionality.
    I just don't know how to add tags to individual highlights and comments in the pdf viewer.Can I just add text such as `#tag` to a comment in the pdf?
    Thank you very much and many regards!
  • Hi dcgk, thanks for your words.
    Can I just add text such as `#tag` to a comment
    - Short answer would be yes you can
    - A scenario for what you are referring to is a manual entry for every '#tag' you want to enter so yes there is no problem at all.But I understand you are referring to a way to automate this, through templates, syntax, and exports.
    - I would recommend to make some test for you to see how it behave.

    Some clarifications that comes to my mind as I am reading you.

    Places from where you can add tags and comments from the pdf reader:
    - 1.from the pen symbol : comment and tag after having highlighted a text !content attached to text item !findable back in context by clicking the corresponding link, from a child-note and an exported to obsidian note.
    - 2.from the post-it symbol : comment and tag a page !no special link to a text segment !AFAIK I couldn't find it back on context and in page by clicks (I just got page number and have to manually go the corresponding page on an additional step)

    188BET靠谱吗Places where zotero template can add a prefix:
    - 1.pen symbol (highlighted text) !1.1tag !1.2 comment.
    188BET靠谱吗Editable from extensions.zotero.annotations.noteTemplates.highlight in preference pane.
    - 2.post-it symbol !2.1 tag !1.2 comment.
    188BET靠谱吗Editable from extensions.zotero.annotations.noteTemplates.note.

    188BET靠谱吗As a result, the finest granularity you can get with the corresponding suffix in zotero template (example) for obsidian after-treatment:
    - comment from highlight: #hgl/com/
    - tag from highlight: #hgl/tag/
    - comment from post-it (fleeting) note: #fleet/com/
    - tag from post-it (fleeting note): #fleet/tag/

    More aggregated level and maybe more friendly mapping:
    - just tags, whether coming from highlight or from a flying note.Name it #tag/ !#zotag/ or even #/ (in the latter case you might get lost if you use # in another contexts).
    - assume that a note content is by definition a comment and forget about the 'com/'part

    As a recap and as for you case, editing "#tag" in both template should do the work.

    Note that for confort you might want to add a '-' or a '_' (#tag- or #tag_).Because the algorithm will concatenate the tag right after the prefix.
    188BET靠谱吗Also note that if your tagging system co-evolve with another one, you might want to add a distinction sign when coming from zotero (let it #ztag_ for example).
  • Cheatsheet for '#ztag_' added both to your highlighted annotations and to your post-it notes:

    For a simple paragraph.Note the space for the tag join part.Make sure to copy paste your former template before trying.You can reset templates (r-click then reset in advanced pref corresponding item).

    Highlights.188BET靠谱吗From advanced preference edit: extensions.zotero.annotations.noteTemplates.highlight and write

    {{highlight}} {{if tags}}#ztag_{{tags : tags join=' #ztag_'}}{{endif}} {{citation}} {{comment}}



    Notes.188BET靠谱吗From advanced preference, edit extensions.zotero.annotations.noteTemplates.note and write

    {{comment}} {{if tags}}#ztag_{{tags : tags join=' #ztag_'}} {{endif}} {{citation}}



    It hasn't been re-tested.I have adapted it from my current templates which are different.Let me know if there are some issues.

    Some update might come later.
  • edited August 19, 2022
    I created a new discussion188BET靠谱吗to follow on that with an example of the templates and some pictures of Zotero and Obsidian interfaces in the making of the process.

    See that I made some modifications as compared as the templates above : added a "Note:" prefix for comments coming from the flying note field!changed the style with italics and breaking spaces.Also, I permutated the order between comment and quote (comments come before the before the quote).




  • I would love to add the citation key as well (BetterBibText).Is it possible?What would be the syntax for it?
  • @talestomazI think that currently this is not an available variable (see 188BET靠谱吗//www.brodersterzo.com/support/note_templates).
  • Hello!

    Thanks for all of this information!188BET靠谱吗I have been playing around with modifying the templates for annotations and notes, as suggested in the Zotero documentation and some threads like this one.One thing I haven't figured out how to do is to change the title of the notes generated from annotations.Right now it just defaults to "Annotations" and the date.However, I would like to change the template for the notes title to something more useful, like the file name or a brief citation.I tried {{citation}} but that didn't work

    188BET靠谱吗Does anybody know the variable that I would use in the extensions.zotero.annotations.noteTemplates.title template to do this?

    Thanks

    P.S.188BET靠谱吗I am really enjoying the new version of Zotero, and it has really gotten back into using it after setting it aside for a few years.Thanks to the developers.
  • Hi!
    I don't think you can use other variables, and {{citation}} within the title template doesn't work indeed.I think the shortest path to insert citation within note title would be using the default keyboard shortcut ctrl+shift+A on item and paste it on the first line of the note.
    There are a bunch of plugins to customize notes, to my knowledge Mdnote and BetterNote could do what you describe, but you'll have to check.
Sign Inor Registerto comment.