An example of code snippets in Jekyll:
def print_hello_world():
# print "hello world!" in terminal
print('hello world!')
An example of math equations in Jekyll (MathJax):
$$ y(x_i) = f(x_i) + \epsilon(x_i) \tag{definition} $$
MathJax can be imported externally inside the header
of /_layouts/x.html
to allow posts that use x.html
as layout template to display math equations as follow:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
jax: ["input/TeX","output/HTML-CSS"],
displayAlign: "left",
displayIndent: "5em"
});
</script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js"
type="text/javascript">
</script>
If you use the default Jekyll theme minima, you can also download the default post.html
from minima and add MathJax to it. This blog's repo provides a working example of Jekyll default theme (Minima) with MathJax installed.