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 details)
Built Distribution
L2M4M-1.0.4-py3-none-any.whl
(15.0 kB
view details)
File details
Details for the file l2m4m-1.0.4.tar.gz
.
File metadata
- Download URL: l2m4m-1.0.4.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fc451edb281604c1eb9d6fa626a8cce874e8a0d3641cca581c20b7544f51396 |
|
MD5 | a818b80f1892a7e99ded9bb3eac3774c |
|
BLAKE2b-256 | 1d712548c288ef1b27f3419285e45430b8f10b9be8f4c34b4d2ecec2d34baf42 |
File details
Details for the file L2M4M-1.0.4-py3-none-any.whl
.
File metadata
- Download URL: L2M4M-1.0.4-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 766e232b28cfdc6397e9c47162a938dba26e5ab90bddec8d82eccb7896ab46d1 |
|
MD5 | f8cb1f4e4edfe89fcf4573b911ccd98f |
|
BLAKE2b-256 | f68a500639fe4b0b1dfc7775633b9173d96a474bbc0811578e916595c9b323f0 |