Skip to main content

sphinxcontrib-bibtex-urn

Test Status Build Status HTML Docs PDF Docs PyPI version Python version PyPI downloads ZeroVer License Ruff

A Sphinx plugin that extends sphinxcontrib-bibtex with support for URN identifiers (specifically National Bibliography Numbers).

BibTeX entries containing a urn field are rendered with a hyperlinked identifier, similar to how doi fields work:

[Sav23] Niko Savola. Design and modelling of long-coherence qubits using energy participation ratios. Master's thesis, Aalto University, May 2023. URN:NBN:fi:aalto-202305213270.

where URN:NBN:fi:aalto-202305213270 is a clickable link pointing to https://urn.fi/URN:NBN:fi:aalto-202305213270.

Features

Installation

uv add sphinxcontrib-bibtex-urn          # or: pip install sphinxcontrib-bibtex-urn

Usage

Option A – Sphinx extension (recommended)

Add the extension to your conf.py after sphinxcontrib.bibtex. It automatically wraps whatever bibtex_default_style you have configured:

extensions = [
    "sphinxcontrib.bibtex",
    "sphinxcontrib_bibtex_urn",
]

bibtex_default_style = "alpha"    # any pybtex style works
bibtex_bibfiles = ["refs.bib"]

Option B – Direct pybtex style

If you prefer not to use the Sphinx extension, select one of the pre-built styles directly:

extensions = [
    "sphinxcontrib.bibtex",
]

bibtex_default_style = "urn_alpha"   # or urn_plain, urn_unsrt, urn_unsrtalpha
bibtex_bibfiles = ["refs.bib"]

BibTeX entries

Add a urn field to your .bib entries. All URN:NBN namespaces are supported:

% URN:NBN:fi – Finnish National Bibliography Number
@mastersthesis{Sav23,
  author = {Niko Savola},
  title  = {Design and modelling of long-coherence qubits using energy
            participation ratios},
  school = {Aalto University},
  year   = {2023},
  month  = {5},
  urn    = {URN:NBN:fi:aalto-202305213270},
}

% URN:NBN:de – German National Bibliography Number
@book{Example23,
  author    = {Author, Example},
  title     = {An Example German Book},
  publisher = {Springer},
  year      = {2023},
  urn       = {URN:NBN:de:101:1-202301011234},
}

The identifier is rendered as a hyperlink pointing to the appropriate national resolver or the general nbn-resolving.org service. For instance, URN:NBN:fi:aalto-202305213270 links to https://urn.fi/URN:NBN:fi:aalto-202305213270.

URNs in the url field

If the urn field is missing, the plugin also scans the url field. If it contains a link to a supported URN resolver (e.g., https://urn.fi/... or https://nbn-resolving.org/...), it is automatically "promoted" and formatted as a hyperlinked URN identifier.

If the entry contains both a urn field and a url field pointing at the same resolver, the redundant URL is automatically suppressed to avoid duplication. The comparison is case-insensitive (per RFC 8141) and handles both http:// and https:// resolver URLs.

How it works

The plugin provides UrnStyleMixin, a pybtex style mixin that overrides format_entry to append a hyperlinked URN when the field is present. The Sphinx extension (sphinxcontrib_bibtex_urn) dynamically wraps your configured style at build time, so it works with any pybtex formatting style, including third-party ones.

Development

For information on how to set up the development environment, run tests, and contribute to the project, please see CONTRIBUTING.md.

All participants are expected to follow the Code of Conduct.

See the Security Policy for information on how to report vulnerabilities.

Metadata

Release files for sphinxcontrib-bibtex-urn 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sphinxcontrib-bibtex-urn 0.1.1
File Size Uploaded
sphinxcontrib_bibtex_urn-0.1.1.tar.gz 8.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sphinxcontrib-bibtex-urn 0.1.1
File Interpreter ABI Platform
sphinxcontrib_bibtex_urn-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 16.7 kB

Release files / sphinxcontrib_bibtex_urn-0.1.1.tar.gz

Download URL sphinxcontrib_bibtex_urn-0.1.1.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5601b5b2b5ace71aea976bb306d16a9c4e43c08ce870ac746f9d2ef5728b67b3
BLAKE2b-256 checksum
How to use checksums
30af339d2ce345394ad6ce8e37752c9e4c78dd1b591b6c7dddd3139b782e4456
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 2, 2026.

Transparency log

Release files / sphinxcontrib_bibtex_urn-0.1.1-py3-none-any.whl

Download URL sphinxcontrib_bibtex_urn-0.1.1-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3668869ba7c6d6739763293ee326e3cdfb350405f3f1f5b61adb8f567bfcfcd7
BLAKE2b-256 checksum
How to use checksums
d9504e0a2b568c6a69ba07490009feadbd81ab861fb8bc5f55246d5b86f84287
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page