robservable icon indicating copy to clipboard operation
robservable copied to clipboard

Problem with cell number in presence of `viewof` cell

Open juba opened this issue 3 years ago • 2 comments

It seems that the presence of a viewof cell breaks the cells numbering used to display unnamed cells.

For example in the following test notebook :

https://observablehq.com/d/9351a542d6f01f6d

The cell "second unnamed cell" should be number 3, but to display it we have to pass 4 to include :

robservable(
  "https://observablehq.com/d/9351a542d6f01f6d",
  include = 4
)

I think that's because a viewof cell is exported as two cells : one for the input and one for the value, thus breaking the cell counter.

juba avatar Jul 29 '20 12:07 juba

On Twitter I called this technique clever and I stand by that, but it's also not guaranteed by the API that cells will be rendered in this specific order. Including unnamed cells is really cool though, if we get to this we might give them more stable and visible identifiers than order on the page.

thomasballinger avatar Jul 29 '20 17:07 thomasballinger

To give credit where it is due, the clever part is from @timelyportfolio :-)

I agree that having a way, via the API, to identify unnamed cell would indeed be great !

juba avatar Jul 30 '20 14:07 juba