Blog: Templates!
Living document with basic Jekyll templates.
Writing and formatting posts
Text Formatting
Jekyll supports basic formatting such as
- italic
- bold
Strikethrough
Jekyll doesn’t support
- Subscript: H~2~O
- Superscript: X^2^
- Emojis: :joy:
Math Formatting
Inline math is made with \\(
\\)
like this:
\(\nabla_{W} \log p(y=UP \mid x) \frac{1}{2} \)
its strange.
is not made wiht $, it
Fancy math is made with $$
and supports align
environments like this:
\(\begin{align}
\nabla_{\theta} E_x[f(x)] &= \nabla_{\theta} \sum_x p(x) f(x) & \text{definition of expectation} \\
& = \sum_x \nabla_{\theta} p(x) f(x) & \text{swap sum and gradient} \\
& = \sum_x p(x) \frac{\nabla_{\theta} p(x)}{p(x)} f(x) & \text{both multiply and divide by } p(x) \\
& = \sum_x p(x) \nabla_{\theta} \log p(x) f(x) & \text{use the fact that } \nabla_{\theta} \log(z) = \frac{1}{z} \nabla_{\theta} z \\
& = E_x[f(x) \nabla_{\theta} \log p(x) ] & \text{definition of expectation}
\end{align}\)
Images
Embed Youtube videos
YouTube videos, like this one explaining Jekyll, can be embedded with a little HTML like this one:
Comments
You can make comments in the markdown file that aren’t complied, and there are several options
[//]: # COMMENT
should be the most portable comment. It must be on a separate line following a blank line.<!-- COMMENT -->
allows for multi-line and inline comments.
Footnotes
Footnotes are made with [^XXX]
in the text and [^XXX]:
on a separate line with the note. XXX
can be any key that you want 1.
This is a text with a footnote2, that also has a second footnote 3.
Numbering the footnotes is automatic and incrementing.
You can reffer to the same footnote more than once 2.
Horizontal lines are made with ---
Code Formating
This is inline code
and this is a sample code block (supports syntax highlighting):
import numpy as np
def foo(x):
# this is not code, this is a comment
for i in range(x):
print(i)
foo(5)
I like to put the output of code in a separate code block inside a block quote, like so:
0 1 2 3 4
You can also make codeblocks by indenting with 4 spaces, but then you don’t get syntax highlighing.
Lists
Bulleted lists
- Top level
- second
- level
- third
- level
- Top level
Numbered lists
- Item one
- sub item one
- sub item two
- sub item three
- Item two
- sub item one
- sub item two
- sub item three
Task lists
- Write the press release
- Update the website
- Contact the media
Blockquotes
A sample blockquote.
Nested blockquotes are also possible.
Headers work too
This is the outer quote again.