Skip to content

a3nm/python-markdown-math

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

[Travis CI status][Travis] [Travis]: https://travis-ci.org/mitya57/python-markdown-math

Math extension for Python-Markdown

This extension adds math formulas support to Python-Markdown.

Installation

Install from PyPI

pip install python-markdown-math

Install locally

Use setup.py build and setup.py install to build and install this extension, respectively.

The extension name is mdx_math, so you need to add that name to your list of Python-Markdown extensions. Check Python-Markdown documentation for details on how to load extensions.

Usage

To use this extension, you need to include MathJax library in HTML files, like:

<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>

Also, you need to specify a configuration for MathJax. Please note that most of standard configuratons include tex2jax extension, which is not needed with this code.

Example of MathJax configuration:

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
  config: ["MMLorHTML.js"],
  jax: ["input/TeX", "output/HTML-CSS", "output/NativeMML"],
  extensions: ["MathMenu.js", "MathZoom.js"]
});
</script>

Math Delimiters

For inline math, use \(...\).

For standalone math, use $$...$$, \[...\] or \begin...\end.

The single-dollar delimiter ($...$) for inline math is disabled by default, but can be enabled by passing enable_dollar_delimiter=True in the extension configuration.

If you want to render to span elements with inline math rather than script elements, so as to improve fallback when JavaScript is disabled or unavailable, use render_to_span=True.

Notes

If you use ReText, this extension is not needed as it is included by default.

About

Math extension for Python-Markdown

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 90.8%
  • HTML 9.2%