Markdown LaTeX Prerenderer
This is a very simple python-markdown extension, similar to other markdon-latex implementations that adds support for latex in markdown files.
The key differences to other approaches are:
- It does not require javascript on the client
- It does not require nodejs when building
For some reason, I could not find a way to render latex inside a markdown file without Javascript, that seemed crazy to me. So I built this tool. No KaTeX required. No NodeJS required. Just classic latex implementations.
How to use:
Make sure you have dvilualatex and dvisvgm installed on your system.
Then, add LatexExtension to your markdown extension list:
import markdown
from markdown_latex_prerender import LatexExtension
markdown.markdown(
md_str,
extensions=[
LatexExtension(),
...
],
)
How it works:
It uses the hosts dvilualatex and dvisvgm (both usually come with TexLive and friends) to convert a latex snippet to
an svg file. **It does not ship either program itself. This is why it's less that 200 lines of code.
Do not feed it untrusted input. It may break. Or worse.
Caching:
You may want to cache rendered things. For this, you can do something like this:
from my_fav_caching_library import cache_function
import markdown_latex_prerenderer.render as render
render.render_latex = cache_function(render.render_latex)
Or whatever else you feel like doing.
Inpiration:
Since I don't know how to build a python-markdown module to render inline-latex, I asked chatGPT looked at other
peoples solutions. I found this: arithmatex.py
in facelessuser/pymdown-extensions.
I re-used a lot of their code. I guess it works.
Metadata
Release files for markdown-latex-prerender 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| markdown_latex_prerender-0.1.1.tar.gz | 4.3 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| markdown_latex_prerender-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.7 kB
Release files / markdown_latex_prerender-0.1.1.tar.gz
| Download URL | markdown_latex_prerender-0.1.1.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
535e67bb5493c29859b39302cab7aae26960f9bf46718fcbc7ad9afe7c59ec5d
|
|
BLAKE2b-256 checksum How to use checksums |
41ece1a8598f9684db7498aa92c8ccbbeea009f9d95b19cefc1c6820d13aa7d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2025.
Transparency logRelease files / markdown_latex_prerender-0.1.1-py3-none-any.whl
| Download URL | markdown_latex_prerender-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
98a4aaed2da1f0f60cb09454d7fdf99e5c7d591099cc09fd55c7f205930b0e33
|
|
BLAKE2b-256 checksum How to use checksums |
956ba19306780ffe9bbd1b2c09415857f596118492063d293bb739aad5bd8e22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2025.
Transparency logSecurity for markdown-latex-prerender 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for markdown_latex_prerender-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.