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(
4848
4949 # generate tokens
5050 tokens : list [Token ]
51+ cell_id = nb_cell .get ("id" , None )
5152 if nb_cell ["cell_type" ] == "markdown" :
5253 # https://nbformat.readthedocs.io/en/5.1.3/format_description.html#markdown-cells
5354 # TODO if cell has tag output-caption, then use as caption for next/preceding cell?
@@ -60,6 +61,7 @@ def notebook_to_tokens(
6061 meta = {
6162 "index" : cell_index ,
6263 "metadata" : nb_node_to_dict (nb_cell ["metadata" ]),
64+ "id" : cell_id ,
6365 },
6466 map = [0 , len (nb_cell ["source" ].splitlines ()) - 1 ],
6567 ),
@@ -88,6 +90,7 @@ def notebook_to_tokens(
8890 meta = {
8991 "index" : cell_index ,
9092 "metadata" : nb_node_to_dict (nb_cell ["metadata" ]),
93+ "id" : cell_id ,
9194 },
9295 map = [0 , 0 ],
9396 )
@@ -106,6 +109,7 @@ def notebook_to_tokens(
106109 meta = {
107110 "index" : cell_index ,
108111 "metadata" : nb_node_to_dict (nb_cell ["metadata" ]),
112+ "id" : cell_id ,
109113 },
110114 map = [0 , 0 ],
111115 )
You can’t perform that action at this time.
0 commit comments