Via UX prompt: Ctrl-F to find code in someone's notebook

I saw Tom’s solicitation on Twitter and wanted to share my early UX challenge.

The problem is simple and I’d be surprised if no one else had encountered it: If I know that a long notebook uses a little snippet of code, I haven’t noticed a way to pop open all the cells at one time to search them to find the correct cell, say with ctrl-f, besides exporting it.

Good luck and keep up the good work.

1 Like

Not an ideal solution, but you can use Safe mode for this: Safe mode shows all the code (and only the code) for your notebook. To access Safe mode, either add /safe to the URL in the address bar, or from your profile, click on the little menu for your notebook and then click Safe mode.

(Because Observable syncs your changes in realtime as you commit them, you can also develop notebooks in safe mode and non-safe mode in two side-by-side windows, if you prefer that style of development.)


Thanks, I had heard of Safe Mode once but hadn’t remembered to use it like that.

The parenthetical method is pretty cool. The websocket sync capability perhaps conflicts with the “safe mode” name: it is a hidden side effect, albeit of the “backend” still being smart, even if the front-end is mostly not.

Happy to resolve this if it’s best.

I think a keyboard shortcut to open/close all (non-pinned) cells would be an excellent addition though!


Is there any way to get the browser to still have the text content of a hidden code block as part of the DOM, and then show the cell in question when it gets a selection event from Find?

Might be unnecessarily complicated / hard to make work across browsers / etc. Just an idea.


Hi team,
I was just pairing with my advanced JS (volunteer) colleague today who had worked as a new user solo otherwise successfully on the collaborative oHQ notebook. He said he was trying to ctrl-F but didn’t realize about safe mode. He did an “Ohhh” and said the find-a-thing-quickly limitation was a significant reason he had been pushing to move us to vanilla GitHub initially.

Consider raising it up in prominence somehow for searchers, besides just the button on the hanging-∞-notebook warning or the maki roll on the notebook profile. Really, everything you said above is gold.

Lucky timing! After today’s launch of cell keyboard shortcuts:

… you can now quickly press Shift-A to select all of the cells in the notebook, and then Ctrl-Shift-P to pin them all open at once, before using Ctrl-F to find the relevant bit of code.

(And you can use the same commands to close them all later, if you choose.)


Has the pin all command changed? Shift-A selects all the cells, but Ctrl-Shift-P doesn’t seem to do anything.

When I’m editing a single cell Ctrl-Shift-P does pin it; I’m looking for a quick way to view all the code in a notebook though.

In visual focus mode, you just need to hit P to pin or unpin cells. Ctrl-Shift-P is only in editing mode (with an editor focused). See the full list of keyboard shortcuts for more.

1 Like