# Styling cells through metadata?

**URL:** <https://discourse.jupyter.org/t/styling-cells-through-metadata/4978>\
**Category:** Notebook\
**Tags:** how-to\
**Created:** [June 26, 2020, 9:07am UTC](https://discourse.jupyter.org/t/styling-cells-through-metadata/4978 "2020-06-26T09:07:15Z")\
**Posts on this page:** 1\
**Showing post:** 23

<div class="post-metadata">

**Author:** ![agoose77](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/agoose77/32/3455_2.png) [@agoose77](https://discourse.jupyter.org/u/agoose77)\
**Post date:** [September 23, 2021, 1:48pm UTC](https://discourse.jupyter.org/t/styling-cells-through-metadata/4978/23 "2021-09-23T13:48:13Z")

</div>

If you would like some pointers on where to look to implement this yourself as an extension, you could look at my [`jupyterlab-imarkdown`](https://github.com/agoose77/jupyterlab-imarkdown/blob/4a564a75ac85240670e4166c36fbbe3a865cb32e/src/index.ts) extension. This extension provides its own `NotebookPanel.IContentFactory`, which it uses to override the behaviour of the Markdown cell.  
This extension does several things, so there are several JupyterLab plugins in `index.ts`. You only need one to provide your custom factory. You can use the [extension cookie-cutter](https://github.com/jupyterlab/extension-cookiecutter-ts) to get started, and inherit directly from `NotebookPanel.ContentFactory` for your factory, (see [jupyterlab-imarkdown/index.ts at 4a564a75ac85240670e4166c36fbbe3a865cb32e · agoose77/jupyterlab-imarkdown · GitHub](https://github.com/agoose77/jupyterlab-imarkdown/blob/4a564a75ac85240670e4166c36fbbe3a865cb32e/src/index.ts#L18-L35))  
You could subclass _all_ of the cell types in your own factory, and listen to the cell model for changes to the metadata. This could then be used to add or remove classes, e.g. [the MARKDOWN\_CELL\_CLASS added in MarkdownCell](https://github.com/jupyterlab/jupyterlab/blob/24a565cae8ef5b8580df9ed868925726723e9dfe/packages/cells/src/widget.ts#L1448)

---

_[View the full topic](https://discourse.jupyter.org/t/styling-cells-through-metadata/4978)._
