Wagtail StreamField block for rendering mathematical equations
Project description
wagtail-polymath
Links
wagtail-polymath allows you to write equations in your Wagtail content using markup and render them beautifully.
wagtail-polymath provides a MathBlock
so you can write equations in markup
(TeX, MathML, ASCIIMath) and render them with MathJax. It features a
live preview:
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.
wagtail-polymath 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 the MathJax documentation for possible configurations.
For help on using the markup languages see the relevant MathJax documentation (e.g. https://docs.mathjax.org/en/v2.7-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
:
# settings.py
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>
Contributing
All contributions are welcome! See CONTRIBUTING.md
Supported versions:
- Python 3.8, 3.9, 3.10, 3.11, 3.12
- Django 4.2, 5.0
- Wagtail 5.2 (LTS), 6.0, 6.1
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
Built Distribution
File details
Details for the file wagtailmath-1.3.1.tar.gz
.
File metadata
- Download URL: wagtailmath-1.3.1.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4bc2bb3dd9ca0069b439a7315fd18685ccdffc38044f8027950b6fd42adecd3 |
|
MD5 | 193ea69c93ace64f2bcf7739204994e5 |
|
BLAKE2b-256 | f764889c2182c8b7bc837a46e0c620e8f7fa5c23671993b6f75975dfaa7be059 |
Provenance
The following attestation bundles were made for wagtailmath-1.3.1.tar.gz
:
Publisher:
publish.yml
on wagtail-nest/wagtail-polymath
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
wagtailmath-1.3.1.tar.gz
- Subject digest:
a4bc2bb3dd9ca0069b439a7315fd18685ccdffc38044f8027950b6fd42adecd3
- Sigstore transparency entry: 145081203
- Sigstore integration time:
- Predicate type:
File details
Details for the file wagtailmath-1.3.1-py3-none-any.whl
.
File metadata
- Download URL: wagtailmath-1.3.1-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 737be94311d3f5a16a1bee2c58ee1dc57842f155238fd725411bee8a5064d888 |
|
MD5 | 5d9df64d34c2b67d474883bc266963fb |
|
BLAKE2b-256 | 4030bb84bd529ff8392d2ed7a80a91befaac0c681c80c1e1febf6cc2d034ee14 |
Provenance
The following attestation bundles were made for wagtailmath-1.3.1-py3-none-any.whl
:
Publisher:
publish.yml
on wagtail-nest/wagtail-polymath
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
wagtailmath-1.3.1-py3-none-any.whl
- Subject digest:
737be94311d3f5a16a1bee2c58ee1dc57842f155238fd725411bee8a5064d888
- Sigstore transparency entry: 145081205
- Sigstore integration time:
- Predicate type: