Quick clarification - it is not that smart. Using the IPython display method to show such an object will always generate the HTML, regardless of what frontend is being used. In general, the kernel does not know what frontends will be displaying the information, so it cannot make such decisions.
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| Different behavior between notebook and lab with ipython.display.html() | 10 | 2712 | August 29, 2019 | |
| Determining ipywidget context (lab vs. notebook vs. embedded) | 0 | 860 | December 4, 2019 | |
| How to know from python script if we are in jupyterlab | 4 | 737 | February 18, 2024 | |
| How to obtain HTML string from Markdown, as Jupyter does it? | 7 | 5465 | October 11, 2023 | |
| Executing .ipynb on github? | 20 | 910 | September 10, 2025 |