mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-24 12:05:22 +08:00
remove old notebook format doc at the bottom of nbconvert doc
There is a much more complete doc of the nbformat now, I didn't realize this was here, or I would have removed it when I added the new one.
This commit is contained in:
parent
41e61d42a5
commit
841c4907b1
@ -122,8 +122,6 @@ and using the command::
|
||||
$ ipython nbconvert --config mycfg.py
|
||||
|
||||
|
||||
.. _notebook_format:
|
||||
|
||||
LaTeX citations
|
||||
---------------
|
||||
|
||||
@ -139,92 +137,3 @@ the nbconvert-examples_ repository.
|
||||
|
||||
.. _nbconvert-examples: https://github.com/ipython/nbconvert-examples
|
||||
|
||||
Notebook JSON file format
|
||||
-------------------------
|
||||
|
||||
Notebook documents are JSON files with an ``.ipynb`` extension, formatted
|
||||
as legibly as possible with minimal extra indentation and cell content broken
|
||||
across lines to make them reasonably friendly to use in version-control
|
||||
workflows. You should be very careful if you ever manually edit this JSON
|
||||
data, as it is extremely easy to corrupt its internal structure and make the
|
||||
file impossible to load. In general, you should consider the notebook as a
|
||||
file meant only to be edited by the IPython Notebook app itself, not for
|
||||
hand-editing.
|
||||
|
||||
.. note::
|
||||
|
||||
Binary data such as figures are also saved directly in the JSON file.
|
||||
This provides convenient single-file portability, but means that the
|
||||
files can be large; a ``diff`` of binary data is also not very
|
||||
meaningful. Since the binary blobs are encoded in a single line, they
|
||||
affect only one line of the ``diff`` output, but they are typically very
|
||||
long lines. You can use the ``Cell | All Output | Clear`` menu option to
|
||||
remove all output from a notebook prior to committing it to version
|
||||
control, if this is a concern.
|
||||
|
||||
The notebook server can also generate a pure Python version of your notebook,
|
||||
using the ``File | Download as`` menu option. The resulting ``.py`` file will
|
||||
contain all the code cells from your notebook verbatim, and all Markdown cells
|
||||
prepended with a comment marker. The separation between code and Markdown
|
||||
cells is indicated with special comments and there is a header indicating the
|
||||
format version. All output is removed when exporting to Python.
|
||||
|
||||
As an example, consider a simple notebook called ``simple.ipynb`` which
|
||||
contains one Markdown cell, with the content ``The simplest notebook.``, one
|
||||
code input cell with the content ``print "Hello, IPython!"``, and the
|
||||
corresponding output.
|
||||
|
||||
The contents of the notebook document ``simple.ipynb`` is the following JSON
|
||||
container::
|
||||
|
||||
{
|
||||
"metadata": {
|
||||
"name": "simple"
|
||||
},
|
||||
"nbformat": 3,
|
||||
"nbformat_minor": 0,
|
||||
"worksheets": [
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": "The simplest notebook."
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": "print \"Hello, IPython\"",
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"output_type": "stream",
|
||||
"stream": "stdout",
|
||||
"text": "Hello, IPython\n"
|
||||
}
|
||||
],
|
||||
"prompt_number": 1
|
||||
}
|
||||
],
|
||||
"metadata": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
The corresponding Python script is::
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
# <nbformat>3.0</nbformat>
|
||||
|
||||
# <markdowncell>
|
||||
|
||||
# The simplest notebook.
|
||||
|
||||
# <codecell>
|
||||
|
||||
print "Hello, IPython"
|
||||
|
||||
Note that indeed the output of the code cell, which is present in the JSON
|
||||
container, has been removed in the ``.py`` script.
|
||||
|
@ -80,7 +80,7 @@ nbviewer.
|
||||
|
||||
.. seealso::
|
||||
|
||||
:ref:`Details on the notebook JSON file format <notebook_format>`
|
||||
:ref:`Details on the notebook JSON file format <nbformat>`
|
||||
|
||||
|
||||
Starting the notebook server
|
||||
@ -477,6 +477,6 @@ script back into a notebook will preserve this structure.
|
||||
format.
|
||||
|
||||
.. seealso::
|
||||
:ref:`notebook_format`
|
||||
:ref:`nbformat`
|
||||
|
||||
.. include:: ../links.txt
|
||||
|
Loading…
Reference in New Issue
Block a user