observablehq / feedback

Customer submitted bugs and feature requests
42 stars 3 forks source link

If named cell contains dash, cell embeds are blank #403

Closed amyzhaoyu closed 2 years ago

amyzhaoyu commented 2 years ago

Describe the bug

If I name a cell with a label containing a dash (eg. copy-top) - I can save it in the notebook, however, when I go to embed the notebook cells, the resulting embed (iframe, etc) is blank.

To Reproduce Steps to reproduce the behavior:

  1. In a notebook, name a cell with a label containing a dash - (I didn't try other punctuation but assuming that is probably problematic as well).

    image
  2. Click the checkmark.

  3. Go to ... --> export --> embed cells.

image

Expected behavior Embed should work as expected (ie. the code/visualizations should render).

Desktop (please complete the following information):

CobusT commented 2 years ago

JavaScript does not allow dashes in variable names. In fact, when you create a JavaScript cell in a notebook such as: copy-top = 10 you would get a syntax error.

We should validate the cell name field to avoid this from happening.