msprev / fzf-bibtex

a BibTeX source for fzf
BSD 3-Clause "New" or "Revised" License
129 stars 15 forks source link

Markdown syntax [tite](url) request #24

Closed santiyounger closed 3 years ago

santiyounger commented 3 years ago

I find the markdown conversion extremly useful, thanks for adding this great function

It works great with the formating of books and other entries, but I make heavy use of URL links in my notes and I'd love to be able to have the with the markdown syntax like this [title](url)

this is an example enty in my references.bib

@online{MakingSpacemacsText,
  title = {Making Spacemacs as a Text Editor for Writers | for Beginners | Spacemacs Basics},
  date = {2020},
  url = {https://www.youtube.com/watch?v=xaGHNwBMlnM},
  keywords = {config,custome,spacemacs}

using the command

bibtex-ls references.bib | fzf --multi --ansi | bibtex-markdown references.bib

formats the markdown output like this:

 (2020) 'Making Spacemacs as a Text Editor for Writers | for Beginners | Spacemacs Basics', https://www.youtube.com/watch?v

I'd love to have it formatted like this:

[Making Spacemacs as a Text Editor for Writers | for Beginners | Spacemacs Basics](https://www.youtube.com/watch?v)

This would be amazing! thanks

msprev commented 3 years ago

Thank you for the kind comments!

I'm not sure this is a behaviour though that all users would like to see. As an alternative, that probably better fits what users will expect, I've updated it to wrap the URL in angle brackets.

If you want to produce the behaviour you describe, it's very easy to fork and hack the code yourself do to it. Just look at format.go and the function `EntryToMarkdown'.

santiyounger commented 3 years ago

thank you for the quick reply, I get you you are right. I'll give it a try it looks faily simple to hack it myself

Appreciate the help and thank you for your work!

santiyounger commented 3 years ago

one more question, if it's not too much trouble. While testing things I tried to update to the new format you just added "to wrap the URL in angle brackets." I deleted the previous code and repeated the installation process, but it didn't work

go get github.com/msprev/fzf-bibtex/cmd/bibtex-ls
go install github.com/msprev/fzf-bibtex/cmd/bibtex-ls
go install github.com/msprev/fzf-bibtex/cmd/bibtex-markdown
go install github.com/msprev/fzf-bibtex/cmd/bibtex-cite

I also tried go get -u github.com/msprev/fzf-bibtex/cmd/bibtex-ls

this downloads the src correctly, but after go install I still don't get the "wrap URL in angle brackets." format

are there any other steps I need to take? Thanks

msprev commented 3 years ago

You need to refresh fzf-bibtex's cache. You can do this by touching your .bib files. It only refreshes the caches if the .bib files change (not if the codebase changes).

santiyounger commented 3 years ago

Amazing, thank you so much, that was it!