Hello! I am creating a templater template to allow me to efficiently take literature notes. What I have been unable to do is to code a function to allow me to search within my biblatex references for the right reference to tag the note I am working on. To clarify what I mean, let me explain my setup briefly:
- Biblatex references correspond each to a markdown file in a folder called “references” within my obsidian folder. The name of the markdown file is the same as that of the biblatex key.
- These markdown files that correspond to biblatex references are all tagged in this way:
tags: [reference/book, bibkey/22364ah, etc, etc], where
referenceis a tag used to identify the md note as a reference note,
bookis the biblatex entry type (book, mvbook, inbook, etc.), and
22364ahis the actual biblatex key for the reference (and also the filename itself).
- Following the format of the Obsidian
citationsplugin, my md notes corresponding to biblatex references all have within the YAML properties the usual biblatex fields such as
author: ["Doe, John"],
title: "The Greatest Book Ever", etc.
With this setup in mind, what I want is this: When creating a new permanent note with
templater I want to be shown a list of my references, so that I can select one so that these are added as tags of the form
bibkey/this, bibkey/that, etc to the permanent note I am creating.
I was able to get partial success by using this code:
var annotation = (await tp.system.suggester((item) => item.basename, app.vault.getMarkdownFiles(), false, "Select source of annotation/citation")).basename;
With this, I would be shown a list of all md files in my vault so that I can pick up the right one to be assigned to variable
annotation. Then, I use this variable to create the appropriate tag.
Although this function works, it has several limitations I would like to address:
- It searches all the notes and not a specific subset of notes (I would rather search only those tagged “reference” or those in the “references” folder).
- It only shows the note title, but it is difficult to choose the right note without more context. Ideally, I would like it to show some information related to a file from its YAML properties—say, the value for
title(when they’re set) at the very minimum—to make it easier to know what file I am looking for.