references/notebook-structure.md
751 B查看排版效果| 1 | # Notebook Structure |
| 2 | |
| 3 | Jupyter notebooks are JSON documents with this high-level shape: |
| 4 | |
| 5 | - `nbformat` and `nbformat_minor` |
| 6 | - `metadata` |
| 7 | - `cells` (a list of markdown and code cells) |
| 8 | |
| 9 | When editing `.ipynb` files programmatically: |
| 10 | |
| 11 | - Preserve `nbformat` and `nbformat_minor` from the template. |
| 12 | - Keep `cells` as an ordered list; do not reorder unless intentional. |
| 13 | - For code cells, set `execution_count` to `null` when unknown. |
| 14 | - For code cells, set `outputs` to an empty list when scaffolding. |
| 15 | - For markdown cells, keep `cell_type="markdown"` and `metadata={}`. |
| 16 | |
| 17 | Prefer scaffolding from the bundled templates or `new_notebook.py` (for example, `$CODEX_HOME/skills/jupyter-notebook/scripts/new_notebook.py`) instead of hand-authoring raw notebook JSON. |
文件内容是平台检查时读出的文本,只供查看。平台不会运行包里的任何脚本或程序。

