Last active
January 22, 2020 20:01
-
-
Save hamelsmu/74487c67116bc5c202e2733717f6eb80 to your computer and use it in GitHub Desktop.
Monkey Patch nbdev for Jupyter Blog Posts
This file contains hidden or 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
from nbdev import export2html | |
from nbdev.export2html import Config, Path, _re_digits | |
## Monkey Patch Nbdev For Jupyter Blog Posts ## | |
def _nb2htmlfname(nb_path, dest): | |
if dest is None: dest = Config().doc_path | |
return Path(dest)/_re_digits.sub('', nb_path.with_suffix('.md').name) | |
## apply monkey patch | |
export2html._nb2htmlfname = _nb2htmlfname | |
# convert notebooks to Jekyll compliant blog posts | |
notebook2html(fname='/path/*.ipynb', dest='/_posts') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment