-
-
Save mcwitt/eaec84a6b50ad5ac9fb2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 '{{ site.baseurl }}/notebooks/' + '/'.join(quote(part) for part in parts) | |
c.MarkdownExporter.filters = {'path2url': path2url} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends 'markdown.tpl' %} | |
{%- block header -%} | |
--- | |
layout: post | |
title: "{{resources['metadata']['name']}}" | |
tags: | |
- python | |
- notebook | |
--- | |
{%- endblock header -%} | |
{% block in_prompt %} | |
**In [{{ cell.execution_count }}]:** | |
{% endblock in_prompt %} | |
{% block input %} | |
{{ '{% highlight python %}' }} | |
{{ cell.source }} | |
{{ '{% endhighlight %}' }} | |
{% endblock input %} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment