File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ def notebook_to_tokens(
48
48
49
49
# generate tokens
50
50
tokens : list [Token ]
51
+ cell_id = nb_cell .get ("id" , None )
51
52
if nb_cell ["cell_type" ] == "markdown" :
52
53
# https://nbformat.readthedocs.io/en/5.1.3/format_description.html#markdown-cells
53
54
# TODO if cell has tag output-caption, then use as caption for next/preceding cell?
@@ -60,6 +61,7 @@ def notebook_to_tokens(
60
61
meta = {
61
62
"index" : cell_index ,
62
63
"metadata" : nb_node_to_dict (nb_cell ["metadata" ]),
64
+ "id" : cell_id ,
63
65
},
64
66
map = [0 , len (nb_cell ["source" ].splitlines ()) - 1 ],
65
67
),
@@ -88,6 +90,7 @@ def notebook_to_tokens(
88
90
meta = {
89
91
"index" : cell_index ,
90
92
"metadata" : nb_node_to_dict (nb_cell ["metadata" ]),
93
+ "id" : cell_id ,
91
94
},
92
95
map = [0 , 0 ],
93
96
)
@@ -106,6 +109,7 @@ def notebook_to_tokens(
106
109
meta = {
107
110
"index" : cell_index ,
108
111
"metadata" : nb_node_to_dict (nb_cell ["metadata" ]),
112
+ "id" : cell_id ,
109
113
},
110
114
map = [0 , 0 ],
111
115
)
You can’t perform that action at this time.
0 commit comments