## MathML Support (MathJax)

Thanks to Patrick Edelman for the reference!

Adding LaTeX to Ghost is very simple. Open up ghost/content/themes/YOUR_THEME_NAME/default.hbs. Before </body>, insert:

 1 2 3 4 5 6 7  {{! Mathjax configuration}}

Now test it out: $\sum \frac{1}{n} = H\_n$ should yield $\sum \frac{1}{n} = H_n$.

The configuration is not perfect, however. Action items include:

• Overridding Markdown parsing for $...$ enclosed text. In particular, $\sum_{n=1}^\infty \frac{1}{n} = H_n$ fails to render properly because _..._ is used by Markdown for italics. edit: Thanks to Filip Allberg for helping me figure this out, you need to escape your underscores. $\sum_{n=1}^\infty \frac{1}{n} = H_n$ renders fine if the subscripts are escaped (\_ instead of _) like in $\sum\_{n=1}^\infty \frac{1}{n} = H\_n$
• Math embedding in live preview. I suspect this is not too difficult. edit: I’ve posted directions on how to do this below.

## Syntax Highlighting

Did you notice that the HTML/JS code block above was syntax colored?? Fortunately, this is super easy to do.

• Open ghost/content/themes/YOUR_THEME_NAME/default.hbs.
• Before </body>, insert:  <script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script> 
• Specify highlighting and prettyprinting classes using MarkDown:

prettyprint lang-python
def main():
print(
"Finally... technical writing is as easy as %s" %
' '.join(map(lambda x: str(x), range(1,4))))



## Live Previews

Peter Schmalfeldt wrote a great post on getting syntax highlighting to work in the publisher view as well.

#### Mathjax Live Preview

I was able to adapt Peter’s to enable MathJax live previewing. To do so, edit ghost/core/server/views/default.hbs and before </body> add

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46  {{! Load and configure mathjax }} {{! Re-render MathJax in live preview}} 
Enjoy!