Sven Kreiss ←Articles

pelican-jsmath Plugin

The new plugin is \(\alpha\omega\epsilon s \sigma m \epsilon\), particularly in combination with KaTeX which is used here. It has good support for big equations:


A vector \(\vec{a}\) looks beautiful. Writing order of magnitudes with \(\mathcal{O}(n)\) is pretty. There was a related Pelican issue for support for KaTeX.

The plugin is packaged and can be installed with pip install pelican-jsmath (with a dash) and then added to Pelican in by adding 'pelican_jsmath' (with an underscore) to your PLUGINS list. See the Readme for more details.

Packaging Pelican Plugins

It is great that Pelican supports plugins installed via pip and outside the plugins directory. It gives the plugin author and user more control over the plugin version. This is why I wanted to document the steps I took to make pelican-jsmath a Python package.

Simplest file:

from setuptools import setup

    description='Pelican Plugin that passes math to JavaScript.',
    author='Sven Kreiss',

If you are converting a plugin from the pelican-plugins repository, move your files into a folder, here pelican_jsmath, and add a file. That’s it. You can submit it to pypi if you want, but you can also tell people to install directly from Github using pip install

With packaged plugins, you can manage your dependencies in your requirements.txt as usual.

Testing Packaged Plugins

This Pelican plugin includes a plugin for the Python Markdown parser that modifies the HTML output. It is good to test that this plugin produces valid HTML. The repository includes an example Pelican site which is regenerated on every commit and validated with html5validator.


pelican-jsmath sample

Related Posts

Go Top