{:.no_toc}
<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script>Test home page. Go to Publication Test to look at the bare evaluation results or to Test 2 for a better UX.
- table of contents {:toc}
Steps to convert a Jupyter Notebook to a markdown file compatible with GH-Pages (Jekyll & Liquid).
-
Prepare your notebook for export: In the first code cell inject JavaScript to load
require.js
. This is needed for Plotly to load correctly. You can use the following code:from IPython.display import display, HTML # load require.js display(HTML('<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script>'))
-
Use
nbconvert
to convert your notebook to markdown:jupyter nbconvert --no-prompt --no-input --to markdown notebooks/<notebook>.ipynb
This command will also remove all prompts and input cells for a cleaner output.
-
Clean and sanitize the markdown file: You have to remove all appearences of {{ '
{{
' }},}}
, {{ '{%
' }}, and%}
in the original markdown file, because they are interpreted by Liquid (the used templating engine). You can use the scriptsanitize.sh
for this step. -
Add the front matter to the page to specify its metadata. This includes title, description, its permalink, and other details. Example:
--- title: Test notebook description: This page showcases a html-rendered jupyter notebook permalink: /test-notebook/ ---
Here, we just test out the math engine of Jekyll and kramdown:
The default LaTeX-environments are not supported:
However, you can display a math-block with $$
:
or with \\[
:
\[\lim_{n \to \infty}\Sigma^n_{i=1} \frac{i+2}{4n}\].
Or you can use inline math with \\(
: \(\lim_{n \to \infty}\Sigma^n_{i=1} \frac{i+2}{4n}\).
Try also to use inline math with \$$
:
Here is a reference to the kramdown-Syntax that is used by Jekyll to transform this document to HTML1.
Footnotes
-
Footnote test. ↩