How to write LaTex formula in Ghost's post ?

Or how integrate MathJax into Ghost’s posts ?

Ghost is my favourite editor to write posts, but it is not possible to write LaTex formula natively. And my favourite editor to write LaTex formula is Jupyter.

How integrate the work done in Jupyter into a Ghost’s post ?

Here is my solution:

  • if your post has images, first upload the images into your Ghost’s blog: in your fresh “New Post”, enter ![]() to upload an image. You will see the path where your Ghost instance stores the image. Keep this path for later. See the following post in the Ghost’s help

  • go to you Jupyter Notebook and go to “File -> Download as -> HTML (.html)”; Jupyter will generate the HTML version of your Notebook. You can now do a copy-paste of this HTML code into your Ghost’s “New Post”.

  • the code generated by Jupyter is a full standalone HTML page; to make it work properly in Ghost, the following items must be removed:
    • the doctype,
    • the opening html,
    • the opening and closing head tags,
    • the script command to load jquery.min.js (already loaded by the page generated by Ghost),
    • the opening body and html,
    • the closing body and html tags,
    • the spaces or tabs in front of the HTML script tag to load a JavaScript (in particular the script tag to load MathJax),
    • remove the very long long style tag generated by Jupyter,
  • search for the HTML’s tag img and replace the path in src with the appropriate path obtained at the first point,

  • move the script tags to the end of the page,

  • finally, check the code generated by Ghost for this post, and see if it is a clean HTML page.

The following post is an example of a Ghost’s post created this way from the following Notebook.

Sébastien Attia

My core skill sets are Software Engineering and Machine Learning. One of my greatest strengths is my ability to analyse a problem, break it down in parts and understand those parts..

Geneva, Switzerland