
Show HN: A tool to convert Jupyter notebooks to beautiful blogs - hemanta212
https://github.com/hemanta212/blogger-cli
======
the_watcher
Neat! Anyone working on projects to improve the share-ability, code review,
version control, or web rendering of Jupyter notebooks, feel free to reach out
to me when looking for an enthusiastic early user. Jupyter has been a game
changer for my productivity as a data scientist, but I still struggle with
something that seems as simple as "what's the best way to expose this to other
people easily without having to set up a self-hosted nbviewer".

~~~
amrrs
Is it tough to manually convert the md and use a CMS like Ghost or Hugo for
website?

Alternatively, exporting HTML and publishing can also help right?

I'm curious why did you say so. Moreover did you check the recently released
`voila` package that lets you publish Jupyter notebooks?

~~~
the_watcher
There are a bunch of ways that make it _possible_ to do all of this. What's
really missing is a way to make it as easy as committing code to Github repo
without having to do anything more than install a Github extension.

Right now, I do my work in a notebook, it's automatically converted to a
Markdown file (for code review), and I use nbconvert to generate static html,
which gets deployed to an internal docs site. I've also been tinkering with
ReviewNB, which is trying to make notebook review look like code review, but
it's separate from Github and is still fairly unpolished (but very
promising!).

Ideally, the experience could be something like: * Install Github extension
that offers a notebook review tab and automatically converts notebooks to a
static HTML file that can be served from a url directly accessible from Github

I can think of a bunch of challenges involved in doing something like the
above, but my experience working somewhere that offered a tool that allowed me
to literally click one button within my notebook and have a shareable url that
contained my notebook and the ability to comment line-by-line taught me that
this massively unblocks data scientists, who will otherwise end up
copy/pasting stuff into documents just to deliver things to partners faster.

~~~
amirathi
> and is still fairly unpolished (but very promising!).

I'm all ears. Please write to me at amit@reviewnb.com

I built ReviewNB and push improvements almost every single day :)

------
petters
I have never understood why the "In[5]" and "Out[5]" in jupyter have to be so
prominent, even in a output like this.

~~~
wodenokoto
_5 is a magic variable with the value of the output from cell 5. _ refers to
the last output. Super handy when working interactively.

~~~
numlocked
Oh my god. I have used Jupyter notebooks for 7 years and never knew this. I
just had to fire one up to verify -- and yep; exactly as described. How
amazing! Thank you!

~~~
spondyl
I believe the _5 syntax is specific to Jupyter, but in Python, the output of
the last statement you execute is bound to _

For example, if you simply enter 4 into a Python REPL, printing _ will also
print 4

It's really handy if you call a long statement in the REPL and forget to save
the output to a variable

I wrote about it once if you'd like to see some better examples:
[https://utf9k.net/blog/lost-python-results/](https://utf9k.net/blog/lost-
python-results/)

------
madenine
Cool, but I would rather use a better supported static site generator with an
ipynb plugin (ie, [https://github.com/danielfrg/pelican-
ipynb](https://github.com/danielfrg/pelican-ipynb)) than a tool just for
notebooks.

Especially because this looks like an nbconvert workflow under the hood.

~~~
hemanta212
> Especially because this looks like an nbconvert workflow under the hood.

It is, however I convert it to the most basic html and add custom css and js
to it. So that I can change it to whatever I want. I don't see any problem
with that maybe you could point some out.

I didn't go with pelican(or any static gen) because the build times will be
much slow later on as blogs increase [1] as this guy faced. I like to
configure a lot of things manually and don't want the burden of static gen if
that make sense to you. I just needed a converter.

1\. [https://nipunbatra.github.io/blog/2017/Jupyter-powered-
blog....](https://nipunbatra.github.io/blog/2017/Jupyter-powered-
blog.html#Other-fixes)

------
avilay
Nice. I have been using gitlab CI and a simple Python script to publish my
notes (usually in markdown and Jupyter notebooks) to Gitlab pages. You can
find the output on
[http://avilay.gitlab.io/gyan](http://avilay.gitlab.io/gyan). And if you want
to reuse the code you can find it in
[https://gitlab.com/avilay/gyan/blob/master/publisher/publish...](https://gitlab.com/avilay/gyan/blob/master/publisher/publish.py).
Will surely check out your stuff.

~~~
hemanta212
I didn't find it responsive though. Maybe not your goal but the designs are
similar. Similarly I think you can import nbconvert instead of just calling
from subprocess.

------
fifnir
Nice, have you looked into jupyter-themes? I've played with it a bit to make a
similar notebooks-->static project and it's really great!

------
russfink
I browsed the example link given at the GitHub site, and found this blog entry
on lessons to tell your younger self. This post is amazing! All the advice
rings true. Worth a read! [https://pykancha.github.io/test/2018/cs-phd-
lessons.html](https://pykancha.github.io/test/2018/cs-phd-lessons.html)

~~~
hemanta212
Here is original link: [https://nipunbatra.github.io/blog/2018/cs-phd-
lessons.html](https://nipunbatra.github.io/blog/2018/cs-phd-lessons.html)

------
tluyben2
Offtopic; does anyone know a tool that can turn a directory of source code
into a nicely formatted PDF/PS? So with syntax highlighting etc based on the
file you have and chapter index based on directory structure for instance?

~~~
jason_slack
Pandoc? I haven’t used it in a while though.

------
bufferoverflow
Did something go wrong here?

[https://pykancha.github.io/test/2019/selenium_p1.html](https://pykancha.github.io/test/2019/selenium_p1.html)

~~~
hemanta212
Nope. It was to test my native language for unicode support.

