nvim-telekasten / telekasten.nvim

A Neovim (lua) plugin for working with a markdown zettelkasten / wiki and mixing it with a journal, based on telescope.nvim
MIT License
1.37k stars 86 forks source link

[FR] Implement auto-bibliography functions #153

Closed adrianocorrea closed 2 years ago

adrianocorrea commented 2 years ago

Please confirm

Is your feature request related to a problem? Please describe. It would be nice to port the auto-bibliography functions implemented in sublime_zk to Telekasten. Many notes created in a zettelkasten came from academic articles or books and, thus, have a related bibliography. This bibliography is sometimes kept in a bibtex (or biblatex) file which can be used to retrieve the related bibliographic information when searching for the citation key (e.g. [@key2022])

Describe the solution you'd like Telekasten could implement a function that looks for citation keys in the current note and injects the corresponding bibliographic information at the end of the note. @renerocksai has already created these functions in Python (see class Autobib in sublime_zk.py. They could be implemented "as is" but this would result in mixing Python with Lua in the current plugin. Therefore, depending on the project philosophy, it would be advisable to rewrite the functions as Lua functions.

Describe alternatives you've considered Alternatives considered included:

  1. Creating a separate plugin - done in vimscript.
  2. Copying and pasting the bibliographic information on each note.

Additional context The original sublime_zk plugin implemented the auto-bibliography functions by calling Pandoc's citeproc. Thus, this (potentially optional) feature would require Pandoc to be installed on the OS and added to the path.

lambtho12 commented 2 years ago

See #82. I already made some PR to the telescope-bibtex plugin to allow some partial interactions.

I think it would be best to not re-invent the wheel for that and try to either bring new functionalities to telescope-bibtex or improve interfacing between telescope-bibtex and telekasten. The great benefit here is that telescope-bibtex does not require additional dependencies and is rather lightweight on its own.

The original sublime_zk plugin implemented the auto-bibliography functions by calling Pandoc's citeproc

Auto bibliography would be awesome, but I'd rather avoid installing pandoc. It is huge and requires lots of dependencies on its own. What we could have instead is parsing the file for [@citekey] stuff, passing the citekey to a telescope-bibtex function that would format the citation appropriately and happening all these at the bottom of the note or at the cursor location (and some magic to avoid duplicating entries or whatever).

adrianocorrea commented 2 years ago

Awesome news, @lambtho12 ! You guys rock! I agree that not having additional dependencies is preferable. Since telescope-bibtex is close enough to the requested feature and further improvements to it or integration between the plugins is already on the radar, I am closing the ticket.