* Render Jupyter notebook in tree @ 2018-12-28 13:48 katsuya.horiuchi.biz 2018-12-28 15:54 ` 0 siblings, 1 reply; 3+ messages in thread From: katsuya.horiuchi.biz @ 2018-12-28 13:48 UTC (permalink / raw) Hi all, Is there demand to render Jupyter notebooks in tree view? I personally would love to see them rendered just like GitHub. It can be achieved by calling nbconvert [0] inside the filter. Considering there's ongoing discussion on rendering markdown files, I think this could add additional value to cgit. [0] https://github.com/jupyter/nbconvert Best, Katsuya ^ permalink raw reply [flat|nested] 3+ messages in thread
* Render Jupyter notebook in tree 2018-12-28 13:48 Render Jupyter notebook in tree katsuya.horiuchi.biz @ 2018-12-28 15:54 ` 2018-12-28 16:32 ` katsuya.horiuchi.biz 0 siblings, 1 reply; 3+ messages in thread From: @ 2018-12-28 15:54 UTC (permalink / raw) That could be a nice feature to have. But I'm not sure that it's something that should be there by default. Anyway, I personally run a filter which renders out org-mode files in tree view. It's a bit slow, and lacks a good way to add CSS. ... extension=${REQUEST_URI: -3} case $extension in org) temp=$(mktemp) cat - > $temp.org emacs $temp.org \ --quick \ --batch \ --funcall org-html-export-to-html \ --kill tail -n+10 $temp.html exit 0 ;; esac exec highlight --force -f -I -O xhtml -S "$EXTENSION" # 2>/dev/null On Fri, Dec 28, 2018 at 10:48:22PM +0900, Katsuya Horiuchi wrote: > Hi all, > > Is there demand to render Jupyter notebooks in tree view? > I personally would love to see them rendered just like GitHub. > > It can be achieved by calling nbconvert [0] inside the filter. > Considering there's ongoing discussion on rendering markdown files, I > think this could add additional value to cgit. > > [0] https://github.com/jupyter/nbconvert > > > Best, > > Katsuya > _______________________________________________ > CGit mailing list > CGit at lists.zx2c4.com > https://lists.zx2c4.com/mailman/listinfo/cgit -- hugo ^ permalink raw reply [flat|nested] 3+ messages in thread
* Render Jupyter notebook in tree 2018-12-28 15:54 ` @ 2018-12-28 16:32 ` katsuya.horiuchi.biz 0 siblings, 0 replies; 3+ messages in thread From: katsuya.horiuchi.biz @ 2018-12-28 16:32 UTC (permalink / raw) Thanks for your input, Hugo. I put the following block to syntax-highlighting.py and it worked: ---------- import subprocess if filename[-6:] == '.ipynb': cmd = subprocess.Popen( 'jupyter-nbconvert --stdin --to html --stdout', shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE ) stdout, _ = cmd.communicate(input=data.encode('utf-8')) if stdout: sys.stdout.write(''' </code></pre></td></tr></table> <style> .blob { display: none; } </style> ''') sys.stdout.write("<div>") sys.stdout.write(stdout.decode('utf-8')) sys.stdout.write("</div>") sys.stdout.write("<table class='blob'><tr><td><pre><code>") sys.exit(0) ---------- If converting notebook to html doesn't work for whatever reason, nothing will happen. Anyone thinks this is too complex to add to the default filter? Best, K On Sat, Dec 29, 2018 at 12:55 AM Hugo H?rnquist <hugo at lysator.liu.se> wrote: > > That could be a nice feature to have. But I'm not sure that > it's something that should be there by default. > > Anyway, I personally run a filter which renders out org-mode > files in tree view. It's a bit slow, and lacks a good way to > add CSS. > > ... > extension=${REQUEST_URI: -3} > > case $extension in > org) > temp=$(mktemp) > cat - > $temp.org > emacs $temp.org \ > --quick \ > --batch \ > --funcall org-html-export-to-html \ > --kill > tail -n+10 $temp.html > exit 0 > ;; > esac > > exec highlight --force -f -I -O xhtml -S "$EXTENSION" # 2>/dev/null > > > On Fri, Dec 28, 2018 at 10:48:22PM +0900, Katsuya Horiuchi wrote: > > Hi all, > > > > Is there demand to render Jupyter notebooks in tree view? > > I personally would love to see them rendered just like GitHub. > > > > It can be achieved by calling nbconvert [0] inside the filter. > > Considering there's ongoing discussion on rendering markdown files, I > > think this could add additional value to cgit. > > > > [0] https://github.com/jupyter/nbconvert > > > > > > Best, > > > > Katsuya > > _______________________________________________ > > CGit mailing list > > CGit at lists.zx2c4.com > > https://lists.zx2c4.com/mailman/listinfo/cgit > > -- > hugo > _______________________________________________ > CGit mailing list > CGit at lists.zx2c4.com > https://lists.zx2c4.com/mailman/listinfo/cgit ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-12-28 16:32 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-12-28 13:48 Render Jupyter notebook in tree katsuya.horiuchi.biz 2018-12-28 15:54 ` 2018-12-28 16:32 ` katsuya.horiuchi.biz
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).