# `SnakeBridge.Docs.MathRenderer`
[🔗](https://github.com/nshkrdotcom/snakebridge/blob/v0.16.0/lib/snakebridge/docs/math_renderer.ex#L1)

Renders LaTeX math expressions for documentation.

Converts reStructuredText math directives to Markdown-compatible
math notation (KaTeX/MathJax style).

## Supported Formats

- Inline math: ``:math:`E = mc^2` `` → `$E = mc^2$`
- Display math: `.. math::` blocks → `$$...$$`

# `extract_math`

```elixir
@spec extract_math(String.t() | nil) :: [String.t()]
```

Extracts all math expressions from text.

Returns a list of math expression strings (without delimiters).

# `render`

```elixir
@spec render(String.t() | nil) :: String.t() | nil
```

Renders math expressions in a docstring, converting RST math to Markdown.

## Examples

    iex> MathRenderer.render("The formula is :math:`E = mc^2`.")
    "The formula is $E = mc^2$."

# `to_katex`

```elixir
@spec to_katex(String.t() | nil) :: String.t() | nil
```

Converts math expressions to KaTeX-compatible format.

KaTeX uses `$...$` for inline and `$$...$$` for display math.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
