Skip to main content

Extends Markdown to convert LaTeX to MathML.

Project description

L2M4M

L2M4M (LaTeX2MathML4Markdown) is a Python package that extends the functionality of Markdown to support LaTeX math expressions by converting them to MathML, using Latex2MathML. This package is particularly useful for those who want to include mathematical notation in their Markdown documents without relying on external JavaScript libraries.

Installation

To install L2M4M, use pip:

pip install L2M4M

Usage

import markdown
from l2m4m import LaTeX2MathMLExtension

# Sample Markdown text with LaTeX
text = """
Here is an inline math equation: $E = mc^2$.

Here is a block math equation:

$$ 
\\frac{d}{dx} e^x = e^x
$$

And here is an alternative notation for a block math equation:

\[
x^n + y^n = z^n
\]
"""

# Convert the Markdown text to HTML with LaTeX2MathMLExtension
html = markdown.markdown(text, extensions=[
    LaTeX2MathMLExtension()
])

print(html)

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

l2m4m-1.0.4.tar.gz (16.6 kB view hashes)

Uploaded Source

Built Distribution

L2M4M-1.0.4-py3-none-any.whl (15.0 kB view hashes)

Uploaded Python 3

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