# Feature request: deep links

**URL:** <https://talk.observablehq.com/t/feature-request-deep-links/607>\
**Category:** Feedback\
**Created:** [April 6, 2018, 2:38am UTC](https://talk.observablehq.com/t/feature-request-deep-links/607 "2018-04-06T02:38:06Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![argyleink](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/argyleink/32/298_2.png) [@argyleink](https://talk.observablehq.com/u/argyleink)\
**Post date:** [April 6, 2018, 2:38am UTC](https://talk.observablehq.com/t/feature-request-deep-links/607/1 "2018-04-06T02:38:06Z")

</div>

when articles/docs/code gets long, and you’re talking about it with other people, it’s nice to be able to provide a deep link direct to a part of the article or code. might be a nice feature for a notebook? something like this [blingblingjs/src/index.js at master · argyleink/blingblingjs · GitHub](https://github.com/argyleink/blingblingjs/blob/master/src/index.js#L26)

hmm, i bet if i provided my notebook html with an ID, i could make my own deep links… but i’d only get headers and stuff. pointing to code lines is harder.

---

<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:** [April 6, 2018, 2:51am UTC](https://talk.observablehq.com/t/feature-request-deep-links/607/2 "2018-04-06T02:51:51Z")

</div>

This feature was added not to long ago. See:

> **[Changelog 2018-03-02](https://observablehq.com/@mbostock/changelog-2018-03-02)**
>
> An Observable notebook.

---

<div class="post-metadata">

**Author:** ![argyleink](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/argyleink/32/298_2.png) [@argyleink](https://talk.observablehq.com/u/argyleink)\
**Post date:** [April 6, 2018, 3:42am UTC](https://talk.observablehq.com/t/feature-request-deep-links/607/3 "2018-04-06T03:42:27Z")

</div>

sure enough! and it works great 😀  
p.s. love that the changelogs are notebooks 👍

---

<div class="post-metadata">

**Author:** ![kaleb](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/kaleb/32/825_2.png) [@kaleb](https://talk.observablehq.com/u/kaleb)\
**Post date:** [July 23, 2018, 3:41pm UTC](https://talk.observablehq.com/t/feature-request-deep-links/607/4 "2018-07-23T15:41:45Z")

</div>

> [@argyleink](#):
>
> the article or code. might be a nice feature for a notebook? something like this [https://github.com/argyleink/blingblingjs/blob/master/src/index.js#L26](https://github.com/argyleink/blingblingjs/blob/master/src/index.js#L26)

This may be off topic for this thread, but what about linking to markdown headings? Do we need to explicitly save the markdown to a variable to be able to link to them?

---

<div class="post-metadata">

**Author:** ![mootari](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mootari/32/581_2.png) [@mootari](https://talk.observablehq.com/u/mootari)\
**Post date:** [July 25, 2018, 7:13pm UTC](https://talk.observablehq.com/t/feature-request-deep-links/607/5 "2018-07-25T19:13:38Z")

</div>

> [@kaleb](#):
>
> Do we need to explicitly save the markdown to a variable to be able to link to them?

~~Apparently not, Observable already creates IDs for headings. I noticed that while creating [this example](https://beta.observablehq.com/@mootari/anchor-anchors-in-markdown) that shows how to automatically create IDs from tagged template literals.~~ _Edit: Brain fart, see other post._

@mbostock The slug for that notebook is weirdly off. Not sure if it’s caused by the nested span. Also, nested elements seem to mess with the slug generation for heading IDs (see the h1 e.g., it only contains the generic prefix).

---

<div class="post-metadata">

**Author:** ![bgchen](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/bgchen/32/784_2.png) [@bgchen](https://talk.observablehq.com/u/bgchen)\
**Post date:** [July 26, 2018, 4:55am UTC](https://talk.observablehq.com/t/feature-request-deep-links/607/6 "2018-07-26T04:55:09Z")

</div>

In your example, neither of the markdown heading IDs work as link targets; try [https://beta.observablehq.com/@mootari/anchor-anchors-in-markdown#anchors-in-markdown](https://beta.observablehq.com/@mootari/anchor-anchors-in-markdown#anchors-in-markdown) and [https://beta.observablehq.com/@mootari/anchor-anchors-in-markdown#before-headline](https://beta.observablehq.com/@mootari/anchor-anchors-in-markdown#before-headline).

Here’s my attempt at explaining what’s going on; anyone with a better understanding should feel free to jump in and correct me:

If you peek at the source of an Observable notebook, you’ll see that user code and content is running from a sandboxed iframe; there is also an associated div in the original page (with class “absolute w-100 black pen”) which contains divs (with class “relative”) for each of the cells.

Links to the IDs created in your notebook don’t work because those IDs label stuff inside the iframe. On the other hand, links to explicitly named cells work fine because named cells get IDs in the cell divs, and these live in the original page.

---

<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:** [July 26, 2018, 5:04am UTC](https://talk.observablehq.com/t/feature-request-deep-links/607/7 "2018-07-26T05:04:29Z")

</div>

You can’t link to Markdown headings directly; you can only link to named cells. For example:

```auto
foo = md`# Hed

Graf graf graf graf graf.`

```

The anchor fragment for this cell would be #foo (not #hed) because _foo_ is the name of the cell.

---

<div class="post-metadata">

**Author:** ![RandomFractals](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/randomfractals/32/759_2.png) [@RandomFractals](https://talk.observablehq.com/u/RandomFractals)\
**Post date:** [July 26, 2018, 5:27am UTC](https://talk.observablehq.com/t/feature-request-deep-links/607/8 "2018-07-26T05:27:33Z")

</div>

yeah, just name your html or md section cell you want to ‘deep link’ to and you can reference it like so:

> **[Fibonacci](https://observablehq.com/@randomfractals/fibonacci)**
>
> An Observable notebook by Taras Novak.

---

<div class="post-metadata">

**Author:** ![mootari](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mootari/32/581_2.png) [@mootari](https://talk.observablehq.com/u/mootari)\
**Post date:** [July 26, 2018, 6:44am UTC](https://talk.observablehq.com/t/feature-request-deep-links/607/9 "2018-07-26T06:44:41Z")

</div>

> [@bgchen](#):
>
> If you peek at the source of an Observable notebook, you’ll see that user code and content is running from a sandboxed iframe

Funny thing: I already _know_ that, but after a long hot day it had somehow escaped my mind. Sorry for the noise.

---

<div class="post-metadata">

**Author:** ![Martien](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/martien/32/470_2.png) [@Martien](https://talk.observablehq.com/u/Martien)\
**Post date:** [May 6, 2019, 12:57pm UTC](https://talk.observablehq.com/t/feature-request-deep-links/607/10 "2019-05-06T12:57:46Z")

</div>

Hmmm… I must be doing something wrong here.

Just using `md # Credits` does create `<h1 id="credits"` but `https://observablehq.com/@martien/magic-balls-factory#credits` does not work.

Naming the cell does work: credits = md`# Credits`.

---

<div class="post-metadata">

**Author:** ![tom](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/tom/32/2262_2.png) [@tom](https://talk.observablehq.com/u/tom)\
**Post date:** [May 6, 2019, 3:24pm UTC](https://talk.observablehq.com/t/feature-request-deep-links/607/11 "2019-05-06T15:24:00Z")

</div>

Mike’s note in [Feature request: deep links](https://talk.observablehq.com/t/feature-request-deep-links/607/7) still holds - naming cells lets you link to them, using Markdown headers does not, because notebooks are in sandboxed iframes.
