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.1a7.tar.gz (5.6 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.1a7-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sphinx_fonts-0.0.1a7.tar.gz
  • Upload date:
  • Size: 5.6 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.1a7.tar.gz
Algorithm Hash digest
SHA256 7da3f383a225b623d38c263b3e805620fd0d9b262aa1f3a66bc9bbac2ba44a0b
MD5 ea0ab1efb460848eafd8c69377985c62
BLAKE2b-256 f68aea86daed70e0039aace2b8143610efebc1f8ce949c365e3907b2a0f58092

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_fonts-0.0.1a7.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.1a7-py3-none-any.whl.

File metadata

  • Download URL: sphinx_fonts-0.0.1a7-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sphinx_fonts-0.0.1a7-py3-none-any.whl
Algorithm Hash digest
SHA256 68c109eb6a9b521e9d9105a08fd89b8dfd1012a058d9fcab49cfb05bd32eec11
MD5 f1a8c4a173480edcd252395bb3a82f92
BLAKE2b-256 b77ca045b2021cc717cd474378e305e8df4f7b1a0971ef34096cbda8e0bd1c43

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_fonts-0.0.1a7-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