Skip to content

A custom formatter for SuperFences that displays LuaTeX as SVGs within markdown

License

Notifications You must be signed in to change notification settings

kgnlp/markdown-tex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Markdown Tex

A custom formatter for SuperFences that displays LuaLaTeX as SVGs within Markdown.

This project was inspired by Markdown TikZ.

Installation

For LuaLaTeX compilation, a LaTeX distribution that includes lualatex and dvisvgm executables is required, which have to be available in PATH.

The formatter can be installed via pip. This will also install the PyMdown Extensions package if it is not already available.

pip install git+https://github.com/kgnlp/markdown-tex

Configuration

For use with MkDocs, the formatter can be configured as a custom SuperFences fence in mkdocs.yml:

markdown_extensions:
  - pymdownx.superfences:
      custom_fences:
      - name: latex
        class: latex
        format: !!python/name:markdown_tex.formatter

For direct compatibility with Obsidian TikZJax, it can also be configured for tikz code blocks:

      - name: tikz
        class: tikz
        format: !!python/name:markdown_tex.formatter

Usage

Based on the configuration, latex and tikz codeblocks without a documentclass will now be rendered to SVG and displayed inline. Note that the document class is set to standalone and tikz is included by default to support Obsidian TikZJax.

```latex
\usepackage{amssymb}
\begin{document}

Some \textit{math} can be included as follows: $5x^2 - 4x + 2 = 0$, where $x \in \mathbb{R}^{N}$

\end{document}
```

About

A custom formatter for SuperFences that displays LuaTeX as SVGs within markdown

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages