Mathematics in Ghost
... is entirely possible.
MathJax
Pull in the MathJax.js file and configure delimiters for MathJax to scan. <- This is the standard way. Documentation is here. There is one caveate though. If one uses the default TeX-MML-AM_CHTML
configuration, then the inline-math delimiters are \(
and \)
. Since Markdown 'eats' backslashs if they appear before the characters in the following table, one should write \\(
and \\)
instead.
\ backslash
` backtick
* asterisk
_ underscore
{} curly braces
[] square brackets
() parentheses
# hash mark
+ plus sign
- minus sign (hyphen)
. dot
! exclamation mark
We guess this is how MathJax works:
It traverses the whole DOM, looking for all the delimiters and rendering the thing that sits between the delimiters. Rendering seems to be putting appropriate positioning and font styles on the elements.
MathML
Well, it is said that one can write arbitrary HTML in Markdown, so one may use MathML directly. However Chrome does not seem to support MathML and we personally will avoid writing in MathML because it is too verbose. 🤢
Thoughts
Anyway Maths support in browser is quite awkward. When Ghost supports hooks, the effect of MathJax can be rendered on the server. In the current version, Markdown is saved in the mobiledoc
column in the database along with various other meta-data, while the converted HTML is stored under html
. In addition, the plaintext is also stored in the database. OK. Original TeX can be saved rather than having to be converted back from the rendered form. No, we don't plan to implement Maths on blog, just musing.