Skip to main content

LaTeX pre-rendering for pelican

Project description

LaTeX Pre-rendering for Pelican

This plugin hooks itself directly into docutils' reStructuredText parser to render math roles and blocks with KaTeX while building your blog. Therefore, you do not need to ship the KaTeX javascript implementation with your website anymore and improve the accessibility as well as the load time of your internet presence.

For a demo visit this blog post. Notice how all the formulas are just there. There is no loading and the website does not even serve the javascript part of KaTeX.

Installation

First of all, you need to install nodejs so that pelican-katex can run KaTeX. Then run pip install pelican-katex and add "pelican_katex" to the PlUGINS setting in your configuration file. Finally, remove the katex.js <script> tag from your template and enjoy a lighter website and instant formulas.

Configuration

The plugin offers several configuration options that you can set in your pelicanconf.py.

# nodejs binary path or command to run KaTeX with.
# KATEX_NODEJS_BINARY = "node"

# Path to the katex file to use. This project comes with version `0.10` of
# katex but if you want to use a different one you can overwrite the path
# here. To use a katex npm installation, set this to `"katex"`.
# KATEX_PATH = "/path/to/katex.js"

# By default, this plugin will redefine reStructuredText's `math` role and
# directive. However, if you prefer to have leave the docutil's defaults
# alone, you can use this to define a `katex` role for example.
# KATEX_DIRECTIVE = "katex"

# How long to wait for the initial startup of the rendering server. You can
# increasing it but if startup takes longer than one second, something is
# probably seriously broken.
# KATEX_STARTUP_TIMEOUT = 1.0

# Time budget in seconds per call to the rendering engine. 1 second should
# be plenty since most renderings take less than 50ms.
# KATEX_RENDER_TIMEOUT = 1.0

# Here you can pass a dictionary of default options that you want to run
# KaTeX with. All possible options are listed on KaTeX's options page,
# https://katex.org/docs/options.html.
# KATEX = {
#     # Abort the build instead of coloring broken math in red
#     "throwOnError": True
# }

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

pelican-katex-1.2.3.tar.gz (160.1 kB view details)

Uploaded Source

Built Distribution

pelican_katex-1.2.3-py3-none-any.whl (161.5 kB view details)

Uploaded Python 3

File details

Details for the file pelican-katex-1.2.3.tar.gz.

File metadata

  • Download URL: pelican-katex-1.2.3.tar.gz
  • Upload date:
  • Size: 160.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.7.3

File hashes

Hashes for pelican-katex-1.2.3.tar.gz
Algorithm Hash digest
SHA256 732966437120c4b3217fe074f3b503da87681d0629188d6f656e488bc2394f01
MD5 85c4c319bf2ac01bbbe4a4c1966b62ed
BLAKE2b-256 691d9901e97819be036fa6a01f8d08ebff7e6dd3cb9494e7ac6294591ecfb141

See more details on using hashes here.

File details

Details for the file pelican_katex-1.2.3-py3-none-any.whl.

File metadata

  • Download URL: pelican_katex-1.2.3-py3-none-any.whl
  • Upload date:
  • Size: 161.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.7.3

File hashes

Hashes for pelican_katex-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2ff37d452073986a2bd9388dde9583ad759d0975aa6740a83771bd24cbed4fda
MD5 f44316fe8d8f64ce80a13319f6d46023
BLAKE2b-256 06524e7d671e2e7d8ad5012eefe538c7cb6fc23be1f7021b8ea860a9e4b2f62e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page