File tree 3 files changed +43
-1
lines changed
3 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -155,6 +155,7 @@ stream output
155
155
The ``stream `` key was changed to ``name `` to match
156
156
the stream message.
157
157
158
+ .. _display-data :
158
159
159
160
display_data
160
161
************
@@ -291,6 +292,35 @@ regardless of format.
291
292
"source" : "[some nbformat output text]"
292
293
}
293
294
295
+
296
+ Cell attachments
297
+ ----------------
298
+ .. versionadded :: 4.1
299
+
300
+ Markdown and raw cells can have a number of attachments, typically inline
301
+ images that can be referenced in the markdown content of a cell. The ``attachments ``
302
+ dictionary of a cell contains a set of mime-bundles (see :ref: `display_data `)
303
+ keyed by filename that represents the files attached to the cell.
304
+
305
+ .. note ::
306
+
307
+ The ``attachments `` dictionary is an optional field and can be undefined or empty if the cell does not have any attachments.
308
+
309
+
310
+ .. sourcecode :: python
311
+
312
+ {
313
+ "cell_type" : "markdown",
314
+ "metadata" : {},
315
+ "source" : ["Here is an *inline * image "],
316
+ "attachments" : {
317
+ "test.png": {
318
+ "image/png" : ["base64-encoded-png-data"],
319
+ },
320
+ },
321
+ }
322
+
323
+
294
324
Backward-compatible changes
295
325
===========================
296
326
Original file line number Diff line number Diff line change 13
13
14
14
# Change this when incrementing the nbformat version
15
15
nbformat = 4
16
- nbformat_minor = 0
16
+ nbformat_minor = 1
17
17
nbformat_schema = 'nbformat.v4.schema.json'
18
18
19
19
Original file line number Diff line number Diff line change 113
113
"tags" : {"$ref" : " #/definitions/misc/metadata_tags" }
114
114
}
115
115
},
116
+ "attachments" : {"$ref" : " #/definitions/misc/attachments" },
116
117
"source" : {"$ref" : " #/definitions/misc/source" }
117
118
}
118
119
},
136
137
},
137
138
"additionalProperties" : true
138
139
},
140
+ "attachments" : {"$ref" : " #/definitions/misc/attachments" },
139
141
"source" : {"$ref" : " #/definitions/misc/source" }
140
142
}
141
143
},
327
329
"pattern" : " ^[^,]+$"
328
330
}
329
331
},
332
+ "attachments" : {
333
+ "description" : " Media attachments (e.g. inline images), stored as mimebundle keyed by filename." ,
334
+ "type" : " object" ,
335
+ "patternProperties" : {
336
+ ".*" : {
337
+ "description" : " The attachment's data stored as a mimebundle." ,
338
+ "$ref" : " #/definitions/misc/mimebundle"
339
+ }
340
+ }
341
+ },
330
342
"source" : {
331
343
"description" : " Contents of the cell, represented as an array of lines." ,
332
344
"$ref" : " #/definitions/misc/multiline_string"
You can’t perform that action at this time.
0 commit comments