Note that this also works in the Sage REPL (read-eval-print loop), or "command-line interface",
ie, using Sage in a terminal. The reason is that, like Jupyter, it uses IPython behind the scenes.
The difference is that the cell numbers are not displayed there... They still exist though.