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]
# Backends can be of any names
[backend.mylib]
backend_type = "bibfile" # Available backends: "bibfile", "zotero_api"
bibfiles = ["references.bib"]

[backend.my_lab_lib]
backend_type = "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 bibfiles.

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.2.tar.gz (13.1 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.2-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bibli_ls-0.1.5.2.tar.gz
  • Upload date:
  • Size: 13.1 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.2.tar.gz
Algorithm Hash digest
SHA256 d3deb7192d3d305c20e560897910eb0359086ce9ec953c8ae16e03b44a944f7a
MD5 3b340643863475923f34f15e323da468
BLAKE2b-256 aada349cdb73bd80c9fd59c417168518c7f082b0bfa004ef46fba33580075241

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bibli_ls-0.1.5.2-py3-none-any.whl
  • Upload date:
  • Size: 13.9 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c61d616e2baad1d7a5a455a6d9fce30928503ccc7ab95a437e718e9805dfe2f2
MD5 08b32752f16145efc594caa33c1510cc
BLAKE2b-256 7642618cfe4945c0838ba7286f72e8930f8b859433529f96ce9f32412d1b0e91

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