danielfrg / pelican-jupyter

Pelican plugin for blogging with Jupyter/IPython Notebooks
Apache License 2.0
423 stars 105 forks source link

I add an optional feature to copy the raw .ipynb file to the output. This allows you to include a link to download the notebook in the rendered html. #94

Closed fredcallaway closed 6 years ago

danielfrg commented 6 years ago

Thanks for the PR. I like the idea a lot.

Can you make a small change to make the notebook go to the same path as the output *.html file of the article instead of output/notebook I feel thats a more sane default.

danielfrg commented 6 years ago

Thanks for the PR!

leemengtw commented 6 years ago

@fredcallaway Great work! Just a potential issue: I have to change

target_dir = os.path.dirname(filepath).split('content/')[1]

to

target_dir = os.path.dirname(filepath).split('content')[1]

written in markup.py in order to make it work manually.

Maybe there is a more robust way to handle the path string handling.

danielfrg commented 6 years ago

Maybe using os.path.basename?

danielfrg commented 6 years ago

I changed this a little bit to support any path to write on using a variable. Check the readme if you are interested.

leemengtw commented 6 years ago

@danielfrg Thanks for the work, it become very flexible and work like a charm👍

Just a quick thought: Although one can check the Pelican documentation to see how ARTICLE_SAVE_AS work and set their own IPYNB_NB_SAVE_AS, it would be easier for people to understand how it work and customize their IPYNB_NB_SAVE_AS if there is a default value.

Something like

IPYNB_NB_SAVE_AS = 'notebooks/{slug}.ipynb'

in the documentation.