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. For the complete list of configurations, refer to the documentation and the default config.

[backends]
# Backends can be of any names
[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]
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. It cache the results in a bibfile named .{backend name}_{library type}_{library id}.bib. Run the command LSP library.reload_all to refetch the online content.

Building from source

From the root directory:

pip install . # --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.6.1.tar.gz (15.8 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.6.1-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for bibli_ls-0.1.6.1.tar.gz
Algorithm Hash digest
SHA256 984a3c41ca4fb8b624d9acfe03363b2beddd3887dea6c4b620305a5f2a66584a
MD5 8166d28709752087f27dcd74695cc65f
BLAKE2b-256 c692d81407649acf4f83cef004df8e9004f7cebeafecb0e720f6231876acea2f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for bibli_ls-0.1.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6c6d01fdd9272b96fdd6d953dba2e85186108c84e49ff547117c29062c5b9001
MD5 7b8754b9950289f88ed97e6088b8e6e8
BLAKE2b-256 0c0f313e7b67189eab58a41dbc93c26bba8995a4340bba3e4d17fb2e77cd0435

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