Overview
I use this page for testing how structures are rendered on the blog and for templating new posts. I leave this page openly visible as a resource for others who are interested in building their own blog.
Source code:
20151030-test.ipynb
20151030-test-full.html
Heading2
Heading3
Heading4
Heading5
Heading6
Motivations
Why am I doing this?
- Why I'm doing this.
Body
Text with a footnote.1
-
A link:
GitHub link -
A link with code as text:
python
docs
Text with always-rendered dollar signs $1.12.
Text with a non-breaking space.
Text with a referenced portion.
Text referencing above.
Text with an equation \(\mathrm{SE}(X) = \sqrt{(\sum_{i=1}^{n}(X_i-X)^2)/n}\) inline.
Text with an equation
as a paragraph.
Text that is collapsible:
- A plot included via Markdown:
- A screenshot included via HTML:
- A table:
c0 | c1 | c2 | |
---|---|---|---|
0 | a | A | 10 |
1 | b | B | 11 |
2 | c | C | 12 |
- A code snippet:
def my_print(string:str) -> None:
r"""My docstring.
Args:
string (str): String to print.
Returns:
None
"""
print('my '+string)
return None
- A Jupyter Notebook:
TODO: Add exported notebook by embedding HTML rather than copy-paste (issue 5).
Copy-pasted from 20151030-test-basic.html (all cells included):
20151030-test¶
cd ~
# Import standard packages.
import os
import pdb # Debug with pdb.
import subprocess
import sys
import time
# Import installed packages.
import matplotlib.pyplot as plt
import pandas as pd
# Import local packages.
# Append current directory to module search path.
# Autoreload local packages after editing.
# dsdemos
version: https://github.com/stharrold/dsdemos (master branch)
sys.path.insert(0, os.path.join(os.path.curdir, r'dsdemos'))
%reload_ext autoreload
%autoreload 2
import dsdemos as dsd
%matplotlib inline
print("Datestamp:")
print(time.strftime(r'%Y-%m-%dT%H:%M:%S%Z', time.gmtime()))
print()
print("Python version:")
print(sys.version_info)
Globals¶
# File paths
path_static = os.path.join(os.path.expanduser(r'~'), r'stharrold.github.io/content/static')
basename = r'20151030-test'
filename = basename
Section 1¶
Description of section 1.
df = pd.DataFrame([['a', 'A', 10], ['b', 'B', 11], ['c', 'C', 12]], columns=['c0', 'c1', 'c2'])
path_html = os.path.join(path_static, basename, r'table.html')
df.to_html(buf=path_html)
print(path_html)
df
plt.plot([0,1], [0,1])
path_jpg = os.path.join(path_static, basename, r'plot.jpg')
plt.savefig(path_jpg)
print(path_jpg)
Export ipynb to html¶
# Export ipynb to html
path_ipynb = os.path.join(path_static, basename, filename+'.ipynb')
for template in ['basic', 'full']:
path_html = os.path.splitext(path_ipynb)[0]+'-'+template+'.html'
cmd = ['jupyter', 'nbconvert', '--to', 'html', '--template', template, path_ipynb, '--output', path_html]
print(' '.join(cmd))
subprocess.run(args=cmd, check=True)
print()
Helpful links
Some links I found helpful for this blog post:
- Some links here.
Footnotes
-
Text as a footnote. ↩
Comments
comments powered by Disqus