janpalasek / pretty-jupyter Goto Github PK
View Code? Open in Web Editor NEWCreates dynamic html report from jupyter notebook.
Home Page: https://pretty-jupyter.readthedocs.io/
License: GNU General Public License v3.0
Creates dynamic html report from jupyter notebook.
Home Page: https://pretty-jupyter.readthedocs.io/
License: GNU General Public License v3.0
Add support to tokens in code cells. This can be e.g. in jinja markdown or possibly other format too.
Adding support for tokens in code cells would allow us e.g. to use only code cells and completely ignored md cells.
Example:
## Header
[//]: <> (-.- tabset)
We could write variable's value {{ variable }} such as this.
There is, however, one overarching problem: what to do with input cells. When we use code cell as a markdown, it provides no useful additional information. The user won't probably want to look at the code of the markdown with variables, there's no interesting information in there.
Therefore we want to (by default) hide those kind of input cells.
Problematic input:
# Header 1
### Tabset
[]: <> (-.- tabset)
#### Tab 1
#### Tab 2
## Chapter
The algorithm doesn't know that the tabset needs to end before Chapter
section and not include it.
There might be some problematic counter examples, need to investigate.
Tried generating html with this using
jupyter nbconvert --template pj new_report.ipynb --to html
Hi Jan,
It seems that your package depends on the new templating features of nbconvert
introduced in nbconvert 6.0
: described here
And it's not compatible with nbconvert 5.0 right? If so, I suggest adding in a minimum version to your package requirements.
Look at other jupyter project and decide whether itβs a good idea. Would it go along other such as papermill etc?
It might help reduce the pain of working with ipynb internal json structure, even though it is the usual way.
Itables without initialization currently doesn't work.
Get inspired from Rmd styles to implement folding for:
# Chapter 1
## Ignore
[//]: # (-.- .toc-ignore)
## Not Ignore
# Chapter 2
jquery.tocify will output this as a list with one-level with three entries:
Instead of:
The problem occurs only if the first subheader in the section is set as ignored.
How to bypass: The first subheader of a section must not have toc-ignore attribute.
Problem with versions of chrome in selenium tests.
Since %%jinja markdown
is potentially written in half of the cells, it would be nice to have some kind of shortcut. E.g. jmd
.
The description will be filled continously.
Design an approach how to override and customise pages styles.
Long tables lead to overflow, which is currently hidden because useless scrollbar were appearing. The useless scrollbars appeared because the title is not in the main-container.
Solution: Move the title with header to main container and enable scrollbars for very long tables.
Note: Move the hide/show all button as well.
Creating docs in sphinx and having it hosted on readthedocs would improve structuring, quality and versioning of the docs.
<code>
element.Hello, Pretty Jupyter team,
Thank you for sharing this project and I really love the functionalities.
However, I think I found an issue that:
If I need to use the tabsets
functionality, I can't use --embed-images
in nbconvert when exporting, because using <--embed-images>
will cause issues to the tabsets
functionality.
Can you take a look at this issue? Many thanks!
Regards,
Chengfeng Liu
We want to set up for each cell some kind of settings, such as: remove its output, input, stream outputs and stderr.
Decide what is the best way: celltags, or some other way?
This does not get displayed correctly in the output HTML. However, it works without the details and summary tags.
<details>
<summary>...</summary>
```sql
select *
from tab1
where tab1.x = 10;
Thought it won't work, but it works. I'll add it to the tests.
Hi,
awesome work, thank you for sharing this.
I wonder if you are planning to add interactive plot packages support? like R markdown knitted file. it supports plotly, highcharter and many interactive plotting packages.
thank you
E.g. some styling is applied to all tables in the container. There should be possibility to avoid this. There should most likely be st like a class on the table that allows us to turn all styling off.
I am not sure if you call it an issue, but I think the generated html would look better without the blank space at the end.
Thank you again for your time and your package,
Best wishes
Originally posted by @chengfeng-liu in #67 (comment)
Update texts before release:
Currently the tokens ([//]: <> (-.- token1 token2)
serve only for tabsets etc. It could be generalized to add classes or set ids for specified situations.
We can implement it this way: The token will add classes or ids to the previous element. This way, we could style markdown tables, markdown images, refs etc. and e.g. also disable default styling for tables.
Goal is to remove js and css imports that are not used by Pretty Jupyter. Also some dependencies will be optional and it will be able to specify them in the notebook metadata.
Note: I think Jupyter supports this internally with cell metadata.
This is caused by jQuery function nextUntil ignoring text nodes, and:
Improve styles for:
Tabset can have two types: tabset-pills and nav-tabs. Currently there is only pills supported. The goal of this issue is to support other tokens as well, such as these two.
Currently the approach is to transform the tokens from md comment into html span elements with class contianing the tokens.
Ex: [//]: <> (-.- token1 token2)
-> <span class="token1" display..></span><span class="token1" display..></span>
To process the tabset, javascript looks into the first
element after header containing with the appropriate tabset class.
This makes the inherent assumption that markdown wraps all the spans into paragraph, which might not be true. This depends on markdown processor.
More safe approach:
Create tokens as spans. We can ensure that the tokes will be unique by their name. We can add special class that makes the tokens easily searchable
[//]: <> (-.- token1)
-> <span class='pretty-jupyter-token token1' style='display: none;'></span>
One entire comment will lead to one span. This will be more resistant markdown -> html transformation. We need to change the markdown cell preprocessing to have the regex parse multiline etc.
[//]: <> (-.- token1 token2)
-> <span class='pretty-jupyter-token token1 token2' ...></span>
We need to have the javascript more resistant to the markdown processor. For tabset specifically, instead of searching headers, we can search for the elements and the closest wrapper div (e.g. with class pretty-jupyter-section, which we will add before by javascript), while still recommending in the documentation to have it right after the header.
For example in the HTML above the algorithm would first identify the span with class pretty-jupyter-token
and attribute tabset
, also find out that the span has attribute tabset-pills
and it would find the closest parent with class pretty-jupyter-section
.
<div class="pretty-jupyter-section section level3">
<h3>Some header</h3>
<p><span class='pretty-jupyter-token tabset tabset-pills'></span></p>
</div>
Final transformation:
Original md:
### Some header
[//]: <> (-.- tabset tabset-pills)
[//]: <> (-.- some-token)
Into
Transformed md:
### Some header
<span class='pretty-jupyter-token tabset tabset-pills' ...></span><span class='pretty-jupyter-token some-token' ...></span>
<div class="pretty-jupyter-section section level3">
<h3>Some header</h3>
<p><span class='pretty-jupyter-token tabset tabset-pills' ...></span></p>
<p><span class='pretty-jupyter-token some-token ...></span></p>
</div>
Note that the span must be hidden (display none).
The export to pdf is not goal of this project. However if one chooses to do so, it would be good to at least do the following things:
The easiest way could be to create an inherited template jinja template for latex and then use pandoc as nbconvert probably does. Since nbconvert's template don't support tabsets etc, we wouldn't have to worry about it being set for pdf.
TODO:
The goal is to enable users to override any notebook metadata from the command-line when generating the output. This will lead to a greater flexibility at no additional cost.
Add optional dependencies with the following functionality:
Sometimes when I do not end tags correctly, the report breaks:
E.g.: I've written this (notice nto correctly ended )
<details>
<summary><em>...<em></summary>
</details>
And both TOC and tabset stopped working.
This should be investigated and addressed.
Do you have any suggestions how this can be adapted to have a button to allow users to download the ipynb/open the ipynb in colab?
On some environment the mathjax url seems to be for some reason empty. Need to investigate. Possible solution: hardcode the version. This would work better to preserve the properties anyway. Similar thing is done to a lot of other utilities from R.
hello, i'm using sos notebooks in jupyter lab and it seems that %load_ext pretty_jupyter doesn't work in an sos kernel. Am I doing something wrong?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.