Skip to main content

Sphinx extension for self-hosted fonts via Fontsource CDN

Project description

sphinx-fonts

Sphinx extension for self-hosted fonts via Fontsource CDN.

Downloads font files at build time, caches them locally (~/.cache/sphinx-fonts), and injects @font-face declarations via Jinja2 template context.

Install

$ pip install sphinx-fonts

Usage

In your docs/conf.py:

extensions = ["sphinx_fonts"]

sphinx_fonts = [
    {
        "family": "IBM Plex Sans",
        "package": "@fontsource/ibm-plex-sans",
        "version": "5.2.8",
        "weights": [400, 500, 600, 700],
        "styles": ["normal", "italic"],
        "subset": "latin",
    },
]

sphinx_font_css_variables = {
    "--font-stack": '"IBM Plex Sans", sans-serif',
}

Requires a page.html template override that reads the font_faces and font_preload_hrefs context variables. See the gp-sphinx docs for a complete template example.

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

sphinx_fonts-0.0.1a18.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

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

sphinx_fonts-0.0.1a18-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_fonts-0.0.1a18.tar.gz.

File metadata

  • Download URL: sphinx_fonts-0.0.1a18.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sphinx_fonts-0.0.1a18.tar.gz
Algorithm Hash digest
SHA256 c7b76664eebbc91c5882de912dcbf332a58b415bcf29f29ce90a76f5f30cd954
MD5 b9b74f850c78330ddaacc158588f0bdf
BLAKE2b-256 8b2cafe37dc06e97a42e0bf3a4030710653fae2f21362ed344cb3d5bf25d3b1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_fonts-0.0.1a18.tar.gz:

Publisher: release.yml on git-pull/gp-sphinx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sphinx_fonts-0.0.1a18-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_fonts-0.0.1a18-py3-none-any.whl
Algorithm Hash digest
SHA256 aa4d8c110b6b3fde2a508e05121958e0eca72cd0c1dc70dd12c90cc7ecbc225b
MD5 d36bbe328105d3fa9d9ada5ff454434b
BLAKE2b-256 a2a1c65c34aa562cc09a2aa426e648372a8dcb91cead1ac01241002b729dc74a

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_fonts-0.0.1a18-py3-none-any.whl:

Publisher: release.yml on git-pull/gp-sphinx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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