katex extension for Python Markdown
|Manuel Barkhau (firstname.lastname@example.org)||author/maintainer||2019-05||-|
$ pip install markdown-katex
This package includes the following binaries:
If you are on a different platform, or want to use a more recent version of
katex-cli, you will need to install it via npm.
$ pip install katex $ npx katex --version 0.10.2
This extension will always use the locally installed version of KaTeX if it is available, instead of using the implementation bundled with this package.
Formulas can be created and edited interactively using the editor on katex.org. They also have some good documentation for the subset of LaTeX that is supported. When embedding these in your Markdown files, they must be marked with a special syntax in order to be rendered using KaTeX. There are many syntax extensions for Markdown that allow LaTeX formulas to be embedded, however this package only supports the syntax introduced by Gitlab:
- For inline mode formulas: $`...`$
- For display mode formulas: ```math
Here is an example that uses this syntax.
There are two main advantages of this syntax:
- Gitlab has an existing Markdown renderer that can be used without the need to download any software. This implementation also uses KaTeX, so the output should be exactly the same as this extension.
- The fallback behaviour of other Markdown renderers is to render the raw LaTeX as inline code or a code block. This means that they won't inadvertently parse a LaTeX formula as Markdown syntax.
Hopefully other renderers will also adopt support for this syntax as:
- Rendering is done in the browser using KaTeX so implementation effort and should be minimal.
- The false positive rate for existing Markdown documents is negligible (ie. existing alternate use of $` syntax is minimal to non-existent).
$ git clone https://gitlab.com/mbarkhau/markdown-katex $ cd markdown-katex $ make install $ make lint mypy test
mkdocs.yml add this to markdown_extensions.
markdown_extensions: - markdown_katex: no_inline_svg: True
Changelog for https://gitlab.com/mbarkhau/markdown-katex
- Fix: Parsing of inline code when using multiple backticks
- Fix: better error reporting
- Fix: cleanup temp dir
- Initial release
Release history Release notifications
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash SHA256 hash help||File type||Python version||Upload date|
|markdown_katex-201905.7b0-py2.py3-none-any.whl (39.1 MB) Copy SHA256 hash SHA256||Wheel||py2.py3|
|markdown-katex-201905.7b0.tar.gz (38.8 MB) Copy SHA256 hash SHA256||Source||None|