# Embed Showing Observable Cells?

**URL:** <https://talk.observablehq.com/t/embed-showing-observable-cells/2746>\
**Category:** Help\
**Created:** [January 16, 2020, 4:51pm UTC](https://talk.observablehq.com/t/embed-showing-observable-cells/2746 "2020-01-16T16:51:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kickout](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/kickout/32/2541_2.png) [@kickout](https://talk.observablehq.com/u/kickout)\
**Post date:** [January 16, 2020, 4:51pm UTC](https://talk.observablehq.com/t/embed-showing-observable-cells/2746/1 "2020-01-16T16:51:36Z")

</div>

Embedding [this notebook](https://observablehq.com/@kickout/untitled) onto a local live-server to test it out. It’s working (the svg/chart part anyway), however I am seeing HTML output of seemingly every cell? HTML code is below and so is the screenshot of my live-server.

```
<!DOCTYPE html>
<body>
<script type="module">

// Load the Observable runtime and inspector.
import {Runtime, Inspector,Library} from "https://cdn.jsdelivr.net/npm/@observablehq/runtime@4/dist/runtime.js";
const runtime = new Runtime(Object.assign(new Library, {width: 640}));
// Your notebook, compiled as an ES module.
import notebook from "https://api.observablehq.com/@kickout/untitled.js?v=3";

// Load the notebook, observing its cells with a default Inspector
// that simply renders the value of each cell into the provided DOM node.
new Runtime().module(notebook, Inspector.into(document.body));

</script>

```

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/observablehq/original/2X/f/fea9dbdee95d784a54eeae53a74c44e21aba958d.png)

---

<div class="post-metadata">

**Author:** ![jashkenas](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/jashkenas/32/1778_2.png) [@jashkenas](https://talk.observablehq.com/u/jashkenas)\
**Post date:** [January 16, 2020, 5:47pm UTC](https://talk.observablehq.com/t/embed-showing-observable-cells/2746/2 "2020-01-16T17:47:42Z")

</div>

Hi, @kickout,

Yes. This code will render every cell, in order, into `document.body`:

```auto
new Runtime().module(notebook, Inspector.into(document.body));

```

If, instead, you want to only render your slider, button, and chart, try something like this instead:

```auto
<!DOCTYPE html>
<body>
<div id="time"></div>
<div id="yldprod"></div>
<div id="chart"></div>

<script type="module">

import {Runtime, Inspector,Library} from "https://cdn.jsdelivr.net/npm/@observablehq/runtime@4/dist/runtime.js";
const runtime = new Runtime(Object.assign(new Library, {width: 640}));
import notebook from "https://api.observablehq.com/@kickout/untitled.js?v=3";

new Runtime().module(notebook, name => {
  switch (name) {
    case "viewof time": return new Inspector(document.querySelector("#time"));
    case "viewof yldprod": return new Inspector(document.querySelector("#yldprod"));
    case "drawchart": return new Inspector(document.querySelector("#chart"));
  }
});

</script>

```

For more information about how this works, see: [https://observablehq.com/@observablehq/downloading-and-embedding-notebooks](https://observablehq.com/@observablehq/downloading-and-embedding-notebooks)

---

<div class="post-metadata">

**Author:** ![kickout](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/kickout/32/2541_2.png) [@kickout](https://talk.observablehq.com/u/kickout)\
**Post date:** [January 16, 2020, 7:36pm UTC](https://talk.observablehq.com/t/embed-showing-observable-cells/2746/3 "2020-01-16T19:36:50Z")

</div>

Follow-up would be rendering my css cell (named myStyles following other forums posts on here).:

`case "myStyles": return new Inspector(document.querySelector("#NotSureWhatToUse"))`

This basically breaks everything.

---

<div class="post-metadata">

**Author:** ![kickout](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/kickout/32/2541_2.png) [@kickout](https://talk.observablehq.com/u/kickout)\
**Post date:** [January 16, 2020, 7:44pm UTC](https://talk.observablehq.com/t/embed-showing-observable-cells/2746/4 "2020-01-16T19:44:37Z")

</div>

Also, this is no good:

```
import {Runtime, Inspector,Library} from "https://cdn.jsdelivr.net/npm/@observablehq/runtime@4/dist/runtime.js";
import notebook from "https://api.observablehq.com/@kickout/untitled.js?v=3";
  new Runtime().module(notebook, name => (name === "drawchart" || name === "myStyles") && Inspector());

</script>
```

---

<div class="post-metadata">

**Author:** ![jashkenas](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/jashkenas/32/1778_2.png) [@jashkenas](https://talk.observablehq.com/u/jashkenas)\
**Post date:** [January 16, 2020, 8:04pm UTC](https://talk.observablehq.com/t/embed-showing-observable-cells/2746/5 "2020-01-16T20:04:16Z")

</div>

> [@kickout](#):
>
> Follow-up would be rendering my css cell (named myStyles following other forums posts on here).:
> 
> `case "myStyles": return new Inspector(document.querySelector("#NotSureWhatToUse"))`
> 
> This basically breaks everything.

You’ll want to add an HTML div to render the styles into, so:

```html
<!DOCTYPE html>
<body>
<div id="time"></div>
<div id="yldprod"></div>
<div id="chart"></div>
<div id="styles"></div>

<script type="module">

import {Runtime, Inspector,Library} from "https://cdn.jsdelivr.net/npm/@observablehq/runtime@4/dist/runtime.js";
const runtime = new Runtime(Object.assign(new Library, {width: 640}));
import notebook from "https://api.observablehq.com/@kickout/untitled.js?v=3";

new Runtime().module(notebook, name => {
  switch (name) {
    case "viewof time": return new Inspector(document.querySelector("#time"));
    case "viewof yldprod": return new Inspector(document.querySelector("#yldprod"));
    case "drawchart": return new Inspector(document.querySelector("#chart"));
    case "myStyles": return new Inspector(document.querySelector("#styles"));
  }
});

</script>

```

Note the `<div id="styles"></div>` at the top of the page. That’s where your styles will be inserted.
