Skip to main content

Wagtail StreamField block for rendering mathematical equations

Project description

https://badge.fury.io/py/wagtailmath.svg

WagtailMath allows you to write equations in your Wagtail content using markup and render them beautifully.

WagtailMath provides a MathBlock so you can write equations in markup (TeX, MathML, ASCIIMath) and render them with MathJax. It features a live preview:

MathBlock in the Wagtail admin

MathBlock uses MathJax for rendering so there is very little to do on the front end. Simply include the MathJax JS and render the raw MathBlock content as you would for any other streamfield plain text block.

WagtailMath even includes a template tag to include the MathJax JS for you from a CDN. By default, MathJax is configured to accept all recognised markup (TeX, MathML, ASCIIMath) and renders them to HTML. To change the configuration, you can pass the desired config command to the templatetag. See http://docs.mathjax.org/en/latest/config-files.html#combined-configurations for possible configurations.

For help on using the markup languages see the relevant MathJax documentation (e.g. http://docs.mathjax.org/en/latest/tex.html) and the markup language-specific documentation (e.g. https://en.wikibooks.org/wiki/LaTeX)

Quickstart

Install wagtailmath:

pip install wagtailmath

Add it to your INSTALLED_APPS:

INSTALLED_APPS = (
    ...
    'wagtailmath',
    ...
)

Use MathBlock in your StreamField content:

from wagtailmath.blocks import MathBlock

class MyPage(Page):
    body = StreamField([
        ('heading', blocks.CharBlock(classname="full title")),
        ('paragraph', blocks.RichTextBlock()),
        ('equation', MathBlock())
    ])

Use the mathjax template tag in your front end template to load the MathJax library:

{% load wagtailmath %}
...

<script src="{% mathjax %}"></script>

History

1.2.0 (TBD)

  • Upgrade to newer version of Django + Wagtail

0.1.0 (2017-04-24)

  • First release on PyPI.

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

wagtailmath-1.2.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

wagtailmath-1.2.0-py2.py3-none-any.whl (7.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file wagtailmath-1.2.0.tar.gz.

File metadata

  • Download URL: wagtailmath-1.2.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6

File hashes

Hashes for wagtailmath-1.2.0.tar.gz
Algorithm Hash digest
SHA256 6060a15a3a5ccf122e170692f594530129e615632f590e8e563915d9428a2618
MD5 05356c2febabd030ad50660ea2d2eff5
BLAKE2b-256 c4b46530f812570994bca92a74308d94bc5b0ad757b9bf2655014722ee9f1d75

See more details on using hashes here.

File details

Details for the file wagtailmath-1.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: wagtailmath-1.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6

File hashes

Hashes for wagtailmath-1.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2ed4c67eb033a0f0b453b9821b3503b9a9a4166b3d5369a4dc8e69745b2aa213
MD5 a4d754472dd846540d66ef4a1e9dfb2c
BLAKE2b-256 e7c6b1deff6c268bd5905350012723127485ac493ff4fd90fd72818ca5b08891

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