Skip to main content

A simple LSP server for your bibliographies

Project description

Logo

Bibli Language Server

A Language Server that brings bibliographies into your notes.

image-version image-license image-python-versions

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 url field of the citation in an external browser (TODO: make configurable).

Configuration

Create a configuration file .bibli.toml at the root of your note directory. Here is a sample configuration:

[backend]
backend_type = "zotero_api" # Available backends: "bibfile", "zotero_api"

[backend.bibfile]
bibfiles = ["references.bib"]

[backend.zotero_api]
library_id = "5123456" # Your library ID
library_type = "user" # "user"" or "group"
api_key = "XXXXXXXXXXXXXXXXXXXXXXXX"

[cite]
prefix = "@" # e.g., "@john2024paper"

[hover.doc_format]
show_fields = ["abstract", "year", "booktitle", "url"]
format = "table" # Available formats: "table"  and "list" (markdown)

[completion.doc_format]
show_fields = ["abstract", "year", "booktitle"]
format = "list"

Installation

Install the latest release of bibli-ls through pip:

pip install bibli-ls

# Alternatively, on Arch:
pipx install bibli-ls

Neovim

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({})

Backends

Currently, Bibli supports bibfile and zotero_api backends.

bibfile backend loads the library from a local bibtex file.

zotero_api backend connects directly to your Zotero web library, removing the need for maintaining separated bibfile.

Building from source

From the root directory:

pyproject-build
pip install dist/bibli_ls-{version}-py3-none-any.whl # --force-reinstall if needed
# Or for Arch
pipx install . # --force-reinstall if needed

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bibli_ls-0.1.5.1.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bibli_ls-0.1.5.1-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file bibli_ls-0.1.5.1.tar.gz.

File metadata

  • Download URL: bibli_ls-0.1.5.1.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for bibli_ls-0.1.5.1.tar.gz
Algorithm Hash digest
SHA256 4e2f5405485a6e5ff8a2fa1077c1ceae3371e0aabd51402e9ab1e8ad9e4d8598
MD5 042c072fc74fc48ec392d704f67e331f
BLAKE2b-256 c36266f74f458ff8cc60d885f5343cb068f248dee67e83a60068144fe4b40a57

See more details on using hashes here.

File details

Details for the file bibli_ls-0.1.5.1-py3-none-any.whl.

File metadata

  • Download URL: bibli_ls-0.1.5.1-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for bibli_ls-0.1.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a45727a9d25495fb6303c9f0017f53d1a02163966664474ccc0d56ff710cb875
MD5 ed471046f475855bef0107e71607d78b
BLAKE2b-256 3c0a9461de463460c3445490cb05a83a70138b8dd5bfc84082c4b259176c6c7d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page