@@ -134,6 +134,8 @@ class JupyterCell(Directive):
134
134
If provided, the cell output will not be displayed in the output.
135
135
code-below : bool
136
136
If provided, the code will be shown below the cell output.
137
+ linenos : bool
138
+ If provided, the code will be shown with line numbers.
137
139
raises : comma separated list of exception types
138
140
If provided, a comma-separated list of exception type names that
139
141
the cell may raise. If one of the listed execption types is raised
@@ -596,6 +598,8 @@ def cell_output_to_nodes(cell, data_priority, write_stderr, dir, thebe_config):
596
598
597
599
598
600
def attach_outputs (output_nodes , node , thebe_config , cm_language ):
601
+ if not node .attributes ["hide_code" ]: # only add css if code is displayed
602
+ node .attributes ["classes" ] = ["jupyter_container" ]
599
603
if thebe_config :
600
604
source = node .children [0 ]
601
605
thebe_source = ThebeSourceNode (hide_code = node .attributes ['hide_code' ],
@@ -604,7 +608,6 @@ def attach_outputs(output_nodes, node, thebe_config, cm_language):
604
608
thebe_source .children = [source ]
605
609
606
610
node .children = [thebe_source ]
607
- node .attributes ["classes" ] = ["jupyter_container" ] # add jupyter classes even if thebe_config <-- CHECK
608
611
609
612
if not node .attributes ['hide_output' ]:
610
613
thebe_output = ThebeOutputNode ()
@@ -614,12 +617,8 @@ def attach_outputs(output_nodes, node, thebe_config, cm_language):
614
617
else :
615
618
node .children = node .children + [thebe_output ]
616
619
else :
617
- # Only add container class if code is shown
618
620
if node .attributes ['hide_code' ]:
619
621
node .children = []
620
- else :
621
- node .attributes ["classes" ] = ["jupyter_container" ]
622
-
623
622
if not node .attributes ['hide_output' ]:
624
623
if node .attributes ['code_below' ]:
625
624
node .children = output_nodes + node .children
0 commit comments