Skip to main content

A pandoc filter that renders math at build time using KaTeX.

Project description

pandoc-static-katex

A simple pandoc filter that uses KaTeX to render math equations at build time. It makes possible to display equations without any JavaScript execution in the browser.

Example usage

$ cat math.md
# A title and whatnot.

This is inline $\log(\frac{1}{2})$ and this is display:

$$
\int_{-\infty}^{+\infty}\Lamda(x)dx
$$

$ pandoc -s  math.md --filter pandoc-static-katex --to html5 --css https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.8.3/katex.min.css -o math.html

Note that the --katex of pandoc option doesn't add the styles since pandoc doesn't see any math element after the filter pass.

Installation

The script can be installed by pip:

python3 -m pip install pandoc_static_katex

When the filter is run, KaTeX needs to be installed with nodejs; the command

npx katex

must work on the current path. The filter has been developed with version 0.10.2 of KaTeX.

Additionally, pandoc is needed for most usages.

Development mode

It requires flit to be installed from source in development mode.

flit install --symlink

Test script

If pandoc, katex and the filter have all been installed correctly, the command:

python3 run_test.py

should produce rendered results in the test_results folder.

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

pandoc_static_katex-0.1.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

pandoc_static_katex-0.1.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file pandoc_static_katex-0.1.1.tar.gz.

File metadata

  • Download URL: pandoc_static_katex-0.1.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.21.0

File hashes

Hashes for pandoc_static_katex-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6b3981826b50e523c478e37eed7bcd653ada122602cd7a3717f6fe32f56adae3
MD5 4f6aaa3a008f5508b0271053d4217fbc
BLAKE2b-256 dba42eb6ce22ebd58c16a8fbc6e6572e9da5f618cb0ff52e07d1df22d8b15a62

See more details on using hashes here.

File details

Details for the file pandoc_static_katex-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pandoc_static_katex-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ba13b6ac88394202019b114109f4b305d4a30727f310de933338d59ac18e0565
MD5 caf36159192c543763a2c58dcb01301a
BLAKE2b-256 3e38171ab5ee592e1b81c53161404da6e45f70f51b17757b1d314833bd51714d

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