diff --git a/src/mobu/services/business/notebookrunner.py b/src/mobu/services/business/notebookrunner.py index 335c2425..7b9aabb8 100644 --- a/src/mobu/services/business/notebookrunner.py +++ b/src/mobu/services/business/notebookrunner.py @@ -296,14 +296,13 @@ async def execute_code(self, session: JupyterLabSession) -> None: for cell in self.read_notebook(self._notebook): code = "".join(cell["source"]) - if "id" in cell: - cell_id = f'`{cell["id"]}` (#{cell["_index"]})' - else: - cell_id = f'#{cell["_index"]}' + cell_id = ( + cell.get("id") or cell["_index"] or "" + ) ctx = CodeContext( notebook=self._notebook.name, path=str(self._notebook), - cell=cell["id"], + cell=cell_id, cell_number=f"#{cell['_index']}", cell_source=code, )