--Put a batch file and click! Then I made something that converts the .ipynb directly under it to html. --It works even in an environment without python (should) --toc2 (table of contents function) is automatically inserted ← Recommended point of this function! </ Strong> --I made it on mac, but it may work on windows if I rebuild it. (unconfirmed)
――It's hard to start a local server and open a notebook every time to check the contents of a large amount of .ipynb sent. Furthermore, if you are working in a different directory for other work, you will have to set up a number of local servers, which will not be the place for work.
--Method 1: Convert @yorshka .ipynb to .html
jupyter nbconvert --to html hoge.ipynb
--Method 2: Official: Customizing nbconvert --HTML conversion using template ("simplepython.tpl" in the example below). With this method, the table of contents in nbextension such as toc2 can be included as html.
jupyter nbconvert --to python 'example.ipynb' --stdout --template=simplepython.tpl
--Method 3: Open and save noebook on LocalServer
――It's painful when you have to see a lot of .ipynb --Forget the path in template.tpl --Movement of directory is troublesome --You have to put various packages (jupyter, nbconvert, nbextensions, toc2.tpl etc ...) in the python environment. (I want the environment to be simple!) -↑ I can't remember the existence of the package because I created a virtual environment and replaced it from time to time.
Implement GUI-based processing. (Combines existing method commands into one executable file.)
--The package used --pyinstaller: 1 Create an executable file --Jupyter: Use functions such as nbconvert to convert to text-> notebook format-> html --jinja2: Used when loading some template.tpl --Various templates loaded by jinja2 when launching jupyter notebook such as toc2.tpl, full.tpl ...:
――If you feel like the specific contents, I will add it - git link
――It's working properly so far, and it's convenient to be converted to html in 5 seconds.
--I had a hard time embedding the templates in the batchfile.
Because pyinstaller did not recognize the following template file. It's an essential file for jinja2 to convert from text to html.
--As a solution to ↑, I hard-coded .tpl and created a file to read as a string. (Data_tpl.py) It seems that pyinstaller recognizes .pyfile without permission. ――After that, if you convert the template read by string with jinja2.dictLoader, you can inherit jinja2 ({%-extends'hogehoge.html'%}) without permission.
Recommended Posts