Bibli Language Server
A Language Server that brings bibliographies into your notes.
Supported LSP capabilities
| LSP Features | Behavior |
|---|---|
| textDocument/definition | Go to the first definition found in the .bib files. |
| textDocument/references | Find appearance of prefix + ID with ripgrep. |
| textDocument/hover | Show metadata from .bib files based on configurations. |
| textDocument/completion | Triggered by the cite_prefix configuration. Show completion of citation ID for bibtex entries and their documentation. |
| textDocument/diagnoistic | Find citations without a proper entry in the bibfile. |
| textDocument/implementation | (Non-standard) Open the bibtex url/attachment. |
Configuration
Create a configuration file .bibli.toml at the root of your note directory. Here is a sample configuration. For the complete list of configurations, refer to the documentation and the default config.
[backends] # Specifying backends for bibtex libraries
# Backends can be of any names, e.g.,
[backends.mylib]
backend_type = "bibfile" # Available backends: "bibfile", "zotero_api"
bibfiles = ["references.bib"]
[backends.my_lab_lib]
backend_type = "zotero_api"
library_id = "5123456" # Your library ID
library_type = "user" # "user"" or "group"
api_key = "XXXXXXXXXXXXXXXXXXXXXXXX"
[cite] # How to cite bibtex entires, e.g., "[@john2024paper]"
trigger = "@"
[view] # How to display your document externally
viewer = "browser" # Available viewer: `zotero`, `zotero_bbt` and `browser`
[hover.doc_format] # How to display hover documentation
show_fields = ["abstract", "year", "booktitle", "url"]
format = "table" # Available formats: "table" and "list" (markdown)
[completion.doc_format] # How to display hover documentation
show_fields = ["abstract", "year", "booktitle"]
format = "list"
Backends
Currently, Bibli supports bibfile and zotero_api backends.
bibfilebackend loads the library from a local bibtex file.zotero_apibackend connects directly to your Zotero web library, removing the need for maintaining separated bibfiles. It cache the results in a bibfile named.{backend name}_{library type}_{library id}.bib. Run the command LSPlibrary.reload_allto refetch the online content.
Viewers
We support openning the url in browser, or openning PDF attachment (for zotero-based backends). TODO: support custom PDF viewer. The current viewers are:
browser: opens theurlfield in the bibtx entry in your default browserzotero_bbtshows the document in Zotero's PDF viewer (require better bibtex to be installed and Zotero to be running)zoteroshows the entry in Zotero.
Neovim configuration
Automatic configuration through lspconfig has yet to be supported. To enable bibli-ls, put the following code in your Neovim config.
local lspconfig = require("lspconfig")
local configs = require("lspconfig.configs")
if not configs.bibli_ls then
configs.bibli_ls = {
default_config = {
cmd = { "bibli_ls" },
filetypes = { "markdown" },
root_dir = lspconfig.util.root_pattern(".bibli.toml"),
-- Optional: visit the URL of the citation with LSP DocumentImplementation
on_attach = function(client, bufnr)
vim.keymap.set({ "n" }, "<cr>", function()
vim.lsp.buf.implementation()
end)
end,
},
}
end
lspconfig.bibli_ls.setup({})
Helix configuration
To enable bibli-ls, put the following code in your Helix config (.config/helix/languages.toml):
[language-server.bibli-ls]
command = "bibli_ls"
required-root-patterns = [".bibli.toml"]
[[language]]
name = "markdown"
language-servers = ["bibli-ls"] # Add other md lsps like zk, marksman, ...
roots = [".bibli.toml"]
Installation
Install the latest release of bibli-ls through pip:
pip install bibli-ls
# Alternatively, on Arch:
pipx install bibli-ls
Using Nix
Installation via Flakes
In your flake.nix:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
bibli-ls = {
url = "github:kha-dinh/bibli-ls";
inputs.nixpkgs.follows = "nixpkgs";
};
};
# ...
outputs =
{
self,
bibli-ls,
nixpkgs,
...
}@inputs:
let
pkgs-flake = {
bibli-ls = bibli-ls.packages.${system}.default;
};
customOverlays = [
(final: prev: {
flake = pkgs-flake;
})
];
in
nixosConfigurations = {
yourMachine = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
{ nixpkgs.overlays = customOverlays; }
# ...
];
};
};
}
Then you can use it in your configuration:
{
environment.systemPackages = [ pkgs.flake.bibli-ls ];
}
Home Manager Configuration
Add bibli-ls to your home-manager configuration:
{ config, pkgs, ... }:
{
home.packages = [ pkgs.flake.bibli-ls ];
home.file."Sync/Notes/zk/permanent/.bibli.toml".text = ''
[backends]
[backends.library]
backend_type = "bibfile"
bibfiles = ["${config.home.homeDirectory}/Sync/Bibliography/library.bib"]
'';
}
Building from source
From the root directory:
pip install . # --force-reinstall if needed
# Or for Arch
pipx install . # --force-reinstall if needed
# And Nix
nix build # The built package will be available in `./result`. You can also use `nix run`
Metadata
Release files for bibli-ls 0.1.7.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bibli_ls-0.1.7.2.tar.gz | 18.3 kB | Without provenance | Details for bibli_ls-0.1.7.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bibli_ls-0.1.7.2-py3-none-any.whl | Python 3 | none | any | Details for bibli_ls-0.1.7.2-py3-none-any.whl |
Total release size: 36.4 kB
Release files / bibli_ls-0.1.7.2.tar.gz
| Download URL | bibli_ls-0.1.7.2.tar.gz |
|---|---|
| Size | 18.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d14986ebe2116690fd6bb49669e71155a13a7aa27241c8ad44bdec36072d730c
|
|
BLAKE2b-256 checksum How to use checksums |
6c5b698da1f704c1fc07d876db2a8dbc6187fb5826a0e341e1e093d502f1ea10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|
Release files / bibli_ls-0.1.7.2-py3-none-any.whl
| Download URL | bibli_ls-0.1.7.2-py3-none-any.whl |
|---|---|
| Size | 18.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f59c9333f4a02ac83541a570f6ee14e15161d4b1e17d702e31e7204f5fcc5901
|
|
BLAKE2b-256 checksum How to use checksums |
b956e4cc5c6eff6c0f102ec00df403bc0939b6aa731f77b11103bc5e4e40f4fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|
Security for bibli-ls 0.1.7.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.