File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ class MditRenderMixin:
6464 current_node : Any
6565 current_node_context : Any
6666 create_highlighted_code_block : Any
67+ _heading_slugs : Any # TODO create & expose a method in `DocutilsRenderer`
6768
6869 @property
6970 def nb_config (self : SelfType ) -> NbParserConfig :
@@ -179,6 +180,17 @@ def render_nb_cell_code(self: SelfType, token: SyntaxTreeNode) -> None:
179180 cell_metadata = token .meta ["metadata" ],
180181 classes = classes ,
181182 )
183+
184+ cell_id = token .meta ["id" ]
185+ if cell_id :
186+ self .document .note_implicit_target (cell_container , cell_container )
187+ slug = "cell-id=" + cell_id
188+ cell_container ["slug" ] = slug
189+ self ._heading_slugs [slug ] = (
190+ cell_container .line ,
191+ cell_container ["ids" ][0 ],
192+ "" ,
193+ )
182194 if hide_mode :
183195 cell_container ["hide_mode" ] = hide_mode
184196 code_prompt_show = self .get_cell_level_config (
You can’t perform that action at this time.
0 commit comments