Automatic bibtex citation in Qutebrowser!

Gonna be a really short post! hope you enjoy.

I added the feature to my dot files in this commit.

The 'Usual' way to do citations

For me, I use dmstern/html2biblatex Which is really nice and simple javascript script to convert webpages BiBLaTeX. The only problem is that it needs to be 'bookmarked' to execute JavaScript (explained in the project's

Adding it to Qutebrowser

Well, that turned out to be really simple, probably not even worth a blog post :)

just copy the html2biblatex.js file to qutebrowser's JavaScript file location. For me, (in GNU/Linux), it was ~/.local/share/qutebrowser/js/.

Now name the file anything you like, I named mine ~/.local/share/qutebrowser/js/cite.js.

Testing the JS file

Now, type in normal mode, :jseval --file cite.js.


You should see something like the following:


Which means it worked!

Adding a keyboard binding

Typing :jseval --file cite.js every time is very inconvenient, thankfully qutebrowser allows one to set key binds very easily.

All I needed was to add

config.bind("yc", 'jseval --file cite.js')

to my Qutebrowser's (in ~/.config/qutebrowser/!

Now all I need is to press yc, and tada! (btw yc is abbreviation for Yank Citation)