# View-only mode?

**URL:** <https://talk.observablehq.com/t/view-only-mode/447>\
**Category:** Feedback\
**Created:** [March 4, 2018, 10:09pm UTC](https://talk.observablehq.com/t/view-only-mode/447 "2018-03-04T22:09:12Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![mbostock](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mbostock/32/9_2.png) [@mbostock](https://talk.observablehq.com/u/mbostock)\
**Post date:** [March 28, 2018, 9:46pm UTC](https://talk.observablehq.com/t/view-only-mode/447/7 "2018-03-28T21:46:53Z")

</div>

I’ve been referring to these as “inspector cells”. All cells are defined by code, and this code is hidden by default; it’s only shown if the cell is pinned or focused. An inspector cell is any cell that doesn’t return DOM. When a cell returns some non-DOM value such as a number, string, object or function, this is displayed by Observable’s built-in inspector (much like a browser’s developer tools).

There’s no way to hide a cell entirely, and that’s mostly deliberate: we _want_ the code to be accessible to readers so they can read it, learn from it, and even tinker with it. We are view-source at heart.

It is often the case, however, that a cell can be useful for implementation without fitting easily into the narrative flow. What I do for these cells is put them at the end under an **Appendix** h2 header. For example:

> **[To Infinity and Back Again](https://observablehq.com/@mbostock/to-infinity-and-back-again)**
>
> An Observable notebook by Mike Bostock.

A more extreme approach would be to hide the inspector entirely via CSS:

```auto
html`<style>.O--inspect { visibility: hidden; }</style>`

```

But, note that the cell names would still be visible in the left margin, so that might be a little weird.

Another approach is to use `viewof` to override the default inspector and instead show arbitrary DOM. Kelley van Evert shows how (see the `def` cell for implementation):

> **[Tiling butterflies to get a Dragon's Egg origami model](https://observablehq.com/@kelleyvanevert/tiling-butterflies-to-get-a-dragons-egg-origami-model)**
>
> An Observable notebook by Kelley van Evert.

Perhaps the cleanest approach is to use imports. If you break your notebook into two notebooks—one explanatory, mostly Markdown and narrative; the other implementing the chart (possibly exploratory)—then you can import the chart into your explanatory notebook without needing to also show those implementation cells. The import statement would be visible, however, so you can’t hide the code entirely!

In the future, we might formalize the concept of an “appendix” (or perhaps an “implementation section”), and allow that section to be collapsed by default. Or we might go so far as to make notebooks hierarchical, and allow you to embed notebooks within notebooks…

In any case, we’ll try to find a nice compromise that makes the code readily accessible without getting in the way of the narrative.

---

_[View the full topic](https://talk.observablehq.com/t/view-only-mode/447)._
