It's 2016 now, I need to blog
I seriously need to restart my blog. Not only do I need a RMarkdown process, but also for Jupyter Notebooks.
Updating the RMarkdown+jekyll process
A lot of things broke. It turns out I needed to update R to v3.3.0 in order to use the latest version of knitr
, etc. So I went back to brocks
-
Update R to v3.3.0, downloading from https://cran.r-project.org/bin/macosx/
-
In R,
install.packages(c("knitr", "servr", "devtools")) # To process .Rmd files
devtools::install_github("hadley/lubridate") # brocks reqs dev version
devtools::install_github("brendan-r/brocks") # My lazy wrapper funs
- In terminal, do
sudo gem install jekyll
Then everything works again.
Jekyll + Jupyter Notebook?
Starting to look at some of the tutorials. This seems promising. Source can be found at gist
Create jekyll-post template
Extend the markdown template: see gist
jekyll-post.py
try:
from urllib.parse import quote # Py 3
except ImportError:
from urllib2 import quote # Py 2
import os
import sys
c = get_config()
c.NbConvertApp.export_format = 'markdown'
c.MarkdownExporter.template_file = 'jekyll-post'
c.Exporter.file_extension = '.md'
def path2url(path):
"""Turn a file path into a URL"""
parts = path.split(os.path.sep)
return '/notebooks/' + '/'.join(quote(part) for part in parts)
c.MarkdownExporter.filters = {'path2url': path2url}
## Traceback (most recent call last):
## File "<string>", line 8, in <module>
## NameError: name 'get_config' is not defined
Posting
In terminal:
ipython nbconvert --config jekyll-post notebook.ipynb
mv notebook.md ../_drafts # or ../_posts, if we're feeling lucky