##// END OF EJS Templates
Merge pull request #7879 from minrk/rm-old-nbformat...
Thomas Kluyver -
r20527:f1090aee merge
parent child Browse files
Show More
@@ -122,8 +122,6 b' and using the command::'
122 $ ipython nbconvert --config mycfg.py
122 $ ipython nbconvert --config mycfg.py
123
123
124
124
125 .. _notebook_format:
126
127 LaTeX citations
125 LaTeX citations
128 ---------------
126 ---------------
129
127
@@ -139,92 +137,3 b' the nbconvert-examples_ repository.'
139
137
140 .. _nbconvert-examples: https://github.com/ipython/nbconvert-examples
138 .. _nbconvert-examples: https://github.com/ipython/nbconvert-examples
141
139
142 Notebook JSON file format
143 -------------------------
144
145 Notebook documents are JSON files with an ``.ipynb`` extension, formatted
146 as legibly as possible with minimal extra indentation and cell content broken
147 across lines to make them reasonably friendly to use in version-control
148 workflows. You should be very careful if you ever manually edit this JSON
149 data, as it is extremely easy to corrupt its internal structure and make the
150 file impossible to load. In general, you should consider the notebook as a
151 file meant only to be edited by the IPython Notebook app itself, not for
152 hand-editing.
153
154 .. note::
155
156 Binary data such as figures are also saved directly in the JSON file.
157 This provides convenient single-file portability, but means that the
158 files can be large; a ``diff`` of binary data is also not very
159 meaningful. Since the binary blobs are encoded in a single line, they
160 affect only one line of the ``diff`` output, but they are typically very
161 long lines. You can use the ``Cell | All Output | Clear`` menu option to
162 remove all output from a notebook prior to committing it to version
163 control, if this is a concern.
164
165 The notebook server can also generate a pure Python version of your notebook,
166 using the ``File | Download as`` menu option. The resulting ``.py`` file will
167 contain all the code cells from your notebook verbatim, and all Markdown cells
168 prepended with a comment marker. The separation between code and Markdown
169 cells is indicated with special comments and there is a header indicating the
170 format version. All output is removed when exporting to Python.
171
172 As an example, consider a simple notebook called ``simple.ipynb`` which
173 contains one Markdown cell, with the content ``The simplest notebook.``, one
174 code input cell with the content ``print "Hello, IPython!"``, and the
175 corresponding output.
176
177 The contents of the notebook document ``simple.ipynb`` is the following JSON
178 container::
179
180 {
181 "metadata": {
182 "name": "simple"
183 },
184 "nbformat": 3,
185 "nbformat_minor": 0,
186 "worksheets": [
187 {
188 "cells": [
189 {
190 "cell_type": "markdown",
191 "metadata": {},
192 "source": "The simplest notebook."
193 },
194 {
195 "cell_type": "code",
196 "collapsed": false,
197 "input": "print \"Hello, IPython\"",
198 "language": "python",
199 "metadata": {},
200 "outputs": [
201 {
202 "output_type": "stream",
203 "stream": "stdout",
204 "text": "Hello, IPython\n"
205 }
206 ],
207 "prompt_number": 1
208 }
209 ],
210 "metadata": {}
211 }
212 ]
213 }
214
215
216 The corresponding Python script is::
217
218 # -*- coding: utf-8 -*-
219 # <nbformat>3.0</nbformat>
220
221 # <markdowncell>
222
223 # The simplest notebook.
224
225 # <codecell>
226
227 print "Hello, IPython"
228
229 Note that indeed the output of the code cell, which is present in the JSON
230 container, has been removed in the ``.py`` script.
@@ -80,7 +80,7 b' nbviewer.'
80
80
81 .. seealso::
81 .. seealso::
82
82
83 :ref:`Details on the notebook JSON file format <notebook_format>`
83 :ref:`Details on the notebook JSON file format <nbformat>`
84
84
85
85
86 Starting the notebook server
86 Starting the notebook server
@@ -477,6 +477,6 b' script back into a notebook will preserve this structure.'
477 format.
477 format.
478
478
479 .. seealso::
479 .. seealso::
480 :ref:`notebook_format`
480 :ref:`nbformat`
481
481
482 .. include:: ../links.txt
482 .. include:: ../links.txt
General Comments 0
You need to be logged in to leave comments. Login now