Skip to content

Commit 00add47

Browse files
committed
No jupyter execution when not necessary
1 parent 1bb7d91 commit 00add47

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

jupyter_sphinx/execute.py

+11
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,17 @@ def apply(self):
152152
kernel_name = default_kernel
153153
file_name = next(default_names)
154154

155+
# Save time when jupyter notebook execution is not necessary
156+
if not any(not "execute" in node or node["execute"] for node in nodes):
157+
# mimics empty cell output for each node
158+
for node in nodes:
159+
source = node.children[0]
160+
source.attributes["classes"].append("code_cell")
161+
node.attributes["cm_language"] = kernel_name
162+
node += CellOutputNode(classes=["cell_output"])
163+
apply_styling(node, thebe_config)
164+
continue
165+
155166
# Add empty placeholder cells for non-executed nodes so nodes
156167
# and cells can be zipped and the provided input/output
157168
# can be inserted later

0 commit comments

Comments
 (0)