diff --git a/render/html/html.go b/render/html/html.go index 9b83eb9..fa598c3 100644 --- a/render/html/html.go +++ b/render/html/html.go @@ -77,8 +77,8 @@ func (r *Renderer) renderCode(w io.Writer, cell schema.Cell) error { return nil } - div.Open(w, attributes{"class": {"cm-editor", "cm-s-jupyter"}}) - div.Open(w, attributes{"class": {"highlight", "hl-ipython3"}}) + div.Open(w, attributes{"class": {"cm-editor", "cm-s-jupyter"}}, true) + div.Open(w, attributes{"class": {"highlight", "hl-ipython3"}}, true) io.WriteString(w, "
 and collapsing functionality
 	// Pure CSS Collapsible: https://www.digitalocean.com/community/tutorials/css-collapsible
 
-	div.Open(w, attributes{"class": {"jp-InputArea", "jp-Cell-inputArea"}})
+	div.Open(w, attributes{"class": {"jp-InputArea", "jp-Cell-inputArea"}}, true)
 
 	// Prompt In:[1]
-	div.Open(w, attributes{"class": {"jp-InputPrompt", "jp-InputArea-prompt"}})
+	div.Open(w, attributes{"class": {"jp-InputPrompt", "jp-InputArea-prompt"}}, false)
 	if ex, ok := cell.(interface{ ExecutionCount() int }); ok {
 		fmt.Fprintf(w, "In\u00a0[%d]:", ex.ExecutionCount())
 	}
@@ -78,7 +78,7 @@ func (wr *Wrapper) WrapInput(w io.Writer, cell schema.Cell, render render.Render
 				"jp-InputArea-editor",
 			},
 			"data-type": {"inline"},
-		})
+		}, true)
 	} else if isMd {
 		div.Open(w, attributes{
 			"class": {
@@ -87,7 +87,7 @@ func (wr *Wrapper) WrapInput(w io.Writer, cell schema.Cell, render render.Render
 				"jp-RenderedHTMLCommon",
 			},
 			"data-mime-type": {common.MarkdownText},
-		})
+		}, true)
 	}
 
 	// Cell itself
@@ -103,9 +103,9 @@ func (wr *Wrapper) WrapInput(w io.Writer, cell schema.Cell, render render.Render
 }
 
 func (wr *Wrapper) WrapOutput(w io.Writer, cell schema.Outputter, render render.RenderCellFunc) error {
-	div.Open(w, attributes{"class": {"jp-Cell-outputWrapper"}})
+	div.Open(w, attributes{"class": {"jp-Cell-outputWrapper"}}, true)
 	div.OpenClose(w, attributes{"class": {"jp-Collapser", "jp-OutputCollapser", "jp-Cell-outputCollapser"}})
-	div.Open(w, attributes{"class": {"jp-OutputArea jp-Cell-outputArea"}})
+	div.Open(w, attributes{"class": {"jp-OutputArea jp-Cell-outputArea"}}, true)
 
 	// TODO: see how application/json would be handled
 	// TODO: jp-RenderedJavaScript is a thing and so is jp-RenderedLatex (but I don't think we need to do anything about the latter)
@@ -147,10 +147,10 @@ func (wr *Wrapper) WrapOutput(w io.Writer, cell schema.Outputter, render render.
 
 	// Looks like this will always wrap the whole output area!
 	if child {
-		div.Open(w, attributes{"class": {childClass}})
+		div.Open(w, attributes{"class": {childClass}}, true)
 	}
 
-	div.Open(w, attributes{"class": {"jp-OutputPrompt", "jp-OutputArea-prompt"}})
+	div.Open(w, attributes{"class": {"jp-OutputPrompt", "jp-OutputArea-prompt"}}, false)
 	for _, out := range cell.Outputs() {
 		if ex, ok := out.(interface{ ExecutionCount() int }); ok {
 			fmt.Fprintf(w, "Out\u00a0[%d]:", ex.ExecutionCount())
@@ -162,7 +162,7 @@ func (wr *Wrapper) WrapOutput(w io.Writer, cell schema.Outputter, render render.
 	div.Open(w, attributes{
 		"class":          {renderedClass, "jp-OutputArea-output", outputtypeclass},
 		"data-mime-type": {datamimetype},
-	})
+	}, true)
 	for _, out := range cell.Outputs() {
 		_ = render(w, out)
 	}
@@ -184,8 +184,8 @@ const (
 type tag string
 
 // Open the tag with the attributes, e.g. 
. -func (t tag) Open(w io.Writer, attrs attributes) { - t._open(w, attrs, true) +func (t tag) Open(w io.Writer, attrs attributes, newline bool) { + t._open(w, attrs, newline) } func (t tag) _open(w io.Writer, attrs attributes, newline bool) { @@ -221,7 +221,7 @@ type tagger struct { // Open opens the tag with the attributes. func (t *tagger) Open(tag tag, w io.Writer, attr attributes) { - tag.Open(w, attr) + tag.Open(w, attr, true) // TODO: redo t.opened = append(t.opened, tag) } diff --git a/testdata/notebook.golden b/testdata/notebook.golden index 31b5547..df796b5 100644 --- a/testdata/notebook.golden +++ b/testdata/notebook.golden @@ -3,8 +3,7 @@
- + @@ -71,8 +68,7 @@ plt.show()
- +
@@ -81,8 +77,7 @@ plt.show()
-
-
+
# Markdown Cell
 ## LaTeX Equation
@@ -99,8 +94,7 @@ $$
- +