Module

plugins.math

Math plugin for Patitas.

Adds support for LaTeX-style math expressions.

Usage:

>>> md = create_markdown(plugins=["math"])
>>> md("Inline: $E = mc^2$")
'<p>Inline: <span class="math">E = mc^2</span></p>'
>>> md("$$

E = mc^2 $$") '

E = mc^2
'

Syntax:

Inline math: $expression$ Block math: $$expression$$ (on separate lines)

Escaping:

  • \$for literal dollar sign
  • Inside code spans, $ is literal

Notes:

  • This plugin outputs semantic HTML classes
  • Actual math rendering (MathJax, KaTeX) is done client-side
  • Block math with display mode is on separate lines

Thread Safety:

This plugin is stateless and thread-safe.

Classes

MathPlugin 1
Plugin adding $math$ and $$math$$ support. Inline math uses $...$ syntax. Block math uses $$...$$ …

Plugin adding $math$ and $$math$$ support.

Inline math uses $...$ syntax. Block math uses $$...$$ on separate lines.

Enable via Markdown(plugins=["math"]).

Note: The actual parsing is controlled by ParseConfig.math_enabled, which is set by the Markdown class based on the plugins list.

Methods

name 0 str
property
def name(self) -> str
Returns
str