# Testing MathJax with Ghost Markdown

I'm planning a couple of posts that will require writing equations. As the title suggests I'm using MathJax to render equations into HTML.

##### Final code injection in Ghost > Code Injection > Head

```
<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/MathJax.js?config=TeX-MML-AM_CHTML">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [["$", "$"], ["\\(", "\\)"]],
processEscapes: true
}
});
</script>
```

Helpful Posts:

- https://help.ghost.org/article/89-mathjax
- http://ryankingsbury.com/how-to-add-mathjax-to-a-ghost-blog/
- http://blog.neilni.com/2013/12/28/adding-mathjax-to-ghost/ - Protip: Use <p> or <div> for rendering matrices and long equations.

##### Examples with Markdown and rendering

$$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$

```
$$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$
```

```
Inline Equation: $\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$
```

##### Matrices

$$
A=\begin{bmatrix}
a & b\\
c & d\\
e & f
\end{bmatrix}
$$

```
<div>
$$
A=\begin{bmatrix}
a & b\\
c & d\\
e & f
\end{bmatrix}
$$
</div>
```

##### Bayes Theorem

\begin{equation}
\label{eq:bayes}
P(\theta|\textbf{D}) = P(\theta ) \frac{P(\textbf{D} |\theta)}{P(\textbf{D})}
\end{equation}

```
<div>
\begin{equation}
\label{eq:bayes}
P(\theta|\textbf{D}) = P(\theta ) \frac{P(\textbf{D} |\theta)}{P(\textbf{D})}
\end{equation}
</div>
```