Modify appearance of Jupyter notebook output cells
See original GitHub issueDescription
I use mkdocs with this material theme and mknotebooks plugin to render notebook articles as a blog. Everything works good except the appearance of input and output cells are identical. This makes reading code and output hard.
Expected behavior
Notebook cells can be markdown or code input or code output. In a notebook, each appear differently as shown below:

Actual behavior
All types of cells appear alike. Code cells have code highlighting, however this is not sufficient to distinguish inputs and outputs

Package versions
- Python:
python --version:Python 3.7.3 - MkDocs:
mkdocs --version:mkdocs, version 1.0.4 - Material:
pip show mkdocs-material | grep -E ^Version:Version: 4.2.0
Project configuration
site_name: Atma Mani's blog
nav:
- Home: index.md
- Talks: talks.md
- Articles: articles/readme.md
- Cheatsheets: cheatsheets/readme.md
- Spatial Data Science: spatial-data-science/readme.md
- Apps: apps.md
- Resume: resume.md
extra_css:
- 'stylesheets/extra.css' # does not work
exta_javascript:
- 'javascripts/extra.js' # does not work
theme:
name: 'material'
palette:
primary: 'teal'
accent: 'deep orange'
logo:
icon: 'blur_on'
favicon: 'static/favicon.svg'
highlightjs: true
# hljs_languages:
# - python
# - r
# - yaml
copyright: 'Copyright © 2019 - 2020 Atma Mani'
# Plugins
plugins:
- mknotebooks:
execute: false
preamble: ./preamble_script.py # does not work, remove.
# Extensions
markdown_extensions:
- admonition
- codehilite:
guess_lang: false
linenums: false
noclasses: false
use_pygments: true
- toc:
permalink: true
System information
- OS: Windows 10, MacOSX 10.14
- Browser: Firefox 66.0, Chrome 74.x
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Changing Notebook Cell's Default Output — A Quick Jupyter ...
After creating this file, you'll see that it changes the default cell output behavior for the new Notebooks. Super cool, right?
Read more >Can I modify contents in Jupyter Notebook output cell?
No, the output is entirely dependent on the input cell, so you will need to modify the input and run ...
Read more >Formatting code outputs - Jupyter Book
Formatting code outputs#. The formatting of code outputs is highly configurable. Below we give examples of how to format particular outputs and even...
Read more >3.6.2 First steps to editing a Jupyter Notebook | GEOG 489
in the toolbar at the top. When you do this, the “In [ ]:” will disappear and your notebook should look similar to...
Read more >File and Output Formats — JupyterLab 3.6.0b0 documentation
JupyterLab supports image data in cell output and as files in the above formats. In the image file viewer, you can use keyboard...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

SuperFences recently added the ability to include additional classes when using the brace style. You could now target specific code block types and style them different. While I’m not going to attempt to go to great lengths to mimic the opening post’s style, I will at least demonstrate that you can target code blocks of different styles:
Then using some CSS we group a parent input with a parent output by removing the margin in between, and give the output a slightly different color:
Could you add input and output labels with CSS? Sure. Working out alignment would take a bit of work, and you’d probably need to account for some corner cases where Material sizes code blocks different in some cases, but it is probably possible:
Anyways, just thought I’d make this ability known.
This is a local URL, which we cannot view. However, I quickly inspected the code and the extension you use does not generate distinguishable containers, which means it’s not targetable by CSS:
Both containers only have the
.codehilitetableclass, which might originate from the fact that the extension generates Markdown which is then rendered by the CodeHilite extension. I think the only solution is to contact the author of the original extension and discuss whether it’s possible to integrate the preambles (In/Out) in the generated Markdown.Closing this issue, as it’s out of scope.