Skip to main content

Extend markdown2 for use with mathjax

Project description

markdown2Mathjax (https://github.com/constantAmateur/markdown2Mathjax) is a simple package that allows you to use latex style math generated by MathJax (http://mathjax.org) in conjunction with the popular markdown format. There are two implementations of markdown in python, this package is designed to be used with the more widely used and actively maintained of the two, called markdown2 (https://github.com/trentm/python-markdown2). Typical usage is as follows:

#!/usr/bin/env python

from markdown2Mathjax import sanitizeInput, reconstructMath
from markdown2 import markdown

tmp = sanitizeInput(sometxt)
markdedDownText = markdown(tmp[0])
finalOutput = reconstructMath(markedDownText,tmp[1])

(where “sometxt” is a string containing the markdown+mathjax text.)

Usage

By default, math is marked by single $ signs for inline math and double $$ signs for equations. However, any delimiting strings may be used by changing the keyword arguments to the sanitizeInput and reconstructMath functions. Note that by default mathjax does NOT use single dollars signs to delimit inline math, so if you use the defaults for this package, you will have to instruct mathjax to treat it appropriately.

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

markdown2Mathjax-0.2.0.tar.gz (16.7 kB view hashes)

Uploaded Source

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