The ipython display widget doesn't render in my jupyter book HTML output. It does in my sphinx material.
To Reproduce
Steps to reproduce the behavior:
Create a markdown table and try to display it with the ipython widget.
from jinja2 import Environment, BaseLoader
rendered_report_header_table="""# Report
## Sample-1
---
| | | | |
| --- | --- | --- | --- |
| **Patient Name:** | Smith, Todd | **Ordered By:** | Dr. Who |
| **Date of Birth:** | 12/11/1977 | **Sample Collection Date:** | 12/9/2020 |
| **Gender**: | Male | **Sample Accession Date:** | 12/9/2020 |
| **Sample Type:** | blood | **Report Data:** | 12/9/2020 |
| **Sample ID/MRN:** | 1234567 | | |
| **Test Accession:** | BRCA122345 | | |
| **Test Ordered:** | BRCA2 sequencing & Deletion/Duplication analysis | | |
| **Test Code:** | ABCD | | |
| **Test Indictation** | Patient has family history of breast cancer. | | |
---
## Result: Postitive
---
| Gene | Variant | Zygosity | Variant Classification |
|:-------|:----------|:-------------|:-------------------------|
| BRCA2 | c.10G>T | Heterozygous | Likely Pathogenic |
| BRCA2 | c.-172A>G | Heterozygous | Unknown |
"""
# This doesn't work in the jupyterhub output
from IPython.display import display, Markdown, Latex, HTML
display(Markdown(rendered_report_header_table))

Expected behavior
I expect the Markdown widget to display. It does display correctly when using sphinx + nbsphinx +the sphinx-material theme. It also displays correctly in the jupyter notebook itself.

A link to your documentation repository.
Github Repo
Link to Docs in Sphinx
$ jupyter-book build mybook
ERROR ...
Environment
jupyter-book --version:OS: Linux
Python 3.7.5
Jupyter Book: 0.8.3
MyST-NB: 0.10.1
Sphinx Book Theme: 0.0.39
MyST-Parser: 0.12.10
Jupyter-Cache: 0.4.1
NbClient: 0.5.1
Additional context
Nothing else really.
Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:
Hi @jerowe sorry for the late reply, this is because currently jupyter-book (via myst-nb) only renders Markdown output by codes cells against the CommonMark specification (https://spec.commonmark.org/0.29/) which actually does not contain tables (these are added in a plugin).
Integrating Markdown code outputs back into the flow of the overall document, does present a bit of a challenge to keep consistent compared to other output types.
I am intending to have a second pass at the rendering of outputs in the coming weeks though, and I'll report back 馃憤
For exact reference: https://github.com/executablebooks/MyST-NB/blob/8d3dfafafd2ededc672baff64946a1ce5950c87b/myst_nb/render_outputs.py#L239
@chrisjsewell there's no problem. I just really like jupyterbook and this would be a nice feature to have. It's actually only necessary for me for one particular project, and I can use jupyterbook fine on other projects. ;-)
For me this is really important!
It would be good to mention this (and other limitations) clearly in the docs.
My expectation was: if it renders in a live notebook, if it renders in nbviewer, then it will render in Jupyter book.
But that does not seem the case.
I appreciate the difficulties for e.g. pdf output. But for HTML output I would value it very much if Jupyter Book could render as closely as possible as to what Jupyter Notebook/Lab renders.
Currently I'm trying to collate a work of 60+ notebooks in one book. But it turns out to be a bumpy ride.
See also #1113 .
@dirkroorda have you tried using sphinx and nbsphinx? That's what I'm using for my project that requires displaying the markdown widgets. I'm sure jupyter-book will be able to display IPython display widgets.
@chrisjsewell , I'm not sure if this is an option (or just a stupid suggestion ;-) ) but is it possible to use nbsphinx for the ipynb notebooks and the myst-parser for markdown files? Then my markdown widgets would display correctly in the notebooks, and I would get the nice markdown syntax!
Oh and I really like the newest release of jupyter-book! I've been using it for new projects and its NIFTY!
@jerowe
Excellent idea, imho.
Because the rendering of a notebook with its outputcell that can contain arbitrary HTML, Markdown and CSS is quite another thing than rendering a "plain" markdown file.
We have now pretty solid expectations of how an output cell renders whatever we put in it, that it is very disrupting to change that for the sake of wrapping it inside a book.
The look and feel of an output cell is almost sacred!
I have multiple struggles with the Juptyer Book rendering of output cells.
Just a quick note, I'm halfway through a PR that changes how notebook output cells are dealt with (essentially just processing them a bit earlier in the process).
This will fix this issue, so I'd just ask for a little more time (but not too much) 馃槈
Because the rendering of a notebook with its outputcell that can contain arbitrary HTML, Markdown and CSS is quite another thing than rendering a "plain" markdown file.
That is just not correct; nbsphinx does not work theoretically any differently to myst-nb/jupyter-book, particularly once the above PR is merged.
The only difference is that it goes through an extra (unnecessary) step of converting the file to RestructuredText first, rather than straight to the sphinx syntax tree (this is actually a long term goal of nbsphinx anyway).
I have multiple struggles with the Juptyer Book rendering of output cells.
If you have any issue additional to rendering of Markdown, then I would encourage to open additional issues, to point us to what needs fixing 馃槃
Most helpful comment
@dirkroorda have you tried using sphinx and nbsphinx? That's what I'm using for my project that requires displaying the markdown widgets. I'm sure jupyter-book will be able to display IPython display widgets.
@chrisjsewell , I'm not sure if this is an option (or just a stupid suggestion ;-) ) but is it possible to use nbsphinx for the ipynb notebooks and the myst-parser for markdown files? Then my markdown widgets would display correctly in the notebooks, and I would get the nice markdown syntax!