hans / obsidian-citation-plugin

Obsidian plugin which integrates your academic reference manager with the Obsidian editor. Search your references from within Obsidian and automatically create and reference literature notes for papers and books.
MIT License
1.12k stars 83 forks source link

Limit character counts in note title #146

Open va-1984 opened 2 years ago

va-1984 commented 2 years ago

I'm absolutely new to all of this and I don't know what I'm doing. That said, by nosing around the other comments here I figured how to make the plug-in assign a title to a new literature note in the format "First author et al, 2008, Title of the Paper.md":

{{#each` entry.author}}{{#if @first}}{{#if this.family}}{{this.family}}{{#unless @last}} et al.{{/unless}}{{else}}{{../authorString}}{{/if}}{{/if}}{{/each}}, {{#if year}}{{year}}{{else}}no date{{/if}}, {{title}}

This works great, but obviously this can result in some ridiculously long file names. Is there a way to make it cap the number of characters? Thank you and sorry for the newbie question

rsomani95 commented 2 years ago

hey @va-1984, how are you exporting your Zotero library? I'm using BetterBibTeX as described in the README, and that automatically suppress the title (to what degree is configurable, but it does so by default), so filename lengths are short as a result

va-1984 commented 2 years ago

hey @rsomani95 thank you -- when I wrote the question above I was using a .bib file produced by Bookends instead of Zotero if I remember correctly. I've since decided to label my lit notes with "@citekey". Still, it would be neat to learn a solution to shorten names on the plug-in side.