diff --git a/layouts/shortcodes/jupyter.html b/layouts/shortcodes/jupyter.html index 288d44d..51f509b 100644 --- a/layouts/shortcodes/jupyter.html +++ b/layouts/shortcodes/jupyter.html @@ -19,12 +19,10 @@ {{- if eq (index $cell "cell_type") "code" -}} {{- $source := index $cell "source" -}} {{- $sourceContent := (cond (reflect.IsSlice $source) (delimit $source "") $source) -}} -
-
- {{- partial "components/codeblock" (dict "lang" $language "content" $sourceContent) -}} -
- {{- $outputs := index $cell "outputs" -}} +{{ (printf "\n```%s\n%s\n```\n" $language $sourceContent) | safeHTML -}} +
+ {{- $outputs := index $cell "outputs" -}} {{- with $outputs -}}
@@ -38,12 +36,12 @@ {{- else if eq (index $output "output_type") "stream" -}} {{- $text := index $output "text" -}} {{- $textContent := (cond (reflect.IsSlice $text) (delimit $text "") $text) -}} -
{{- $textContent -}}
+
{{- $textContent -}}
{{- else if eq (index $output "output_type") "execute_result" -}} {{- $data := index $output "data" -}} {{- $text := index $data "text/plain" -}} {{- $textContent := (cond (reflect.IsSlice $text) (delimit $text "") $text) -}} -
{{- $textContent -}}
+
{{- $textContent -}}
{{- $html := index $data "text/html" -}} {{- if $html -}} {{- $htmlText := delimit $html "" -}} @@ -58,9 +56,9 @@ {{- end -}}
{{- else if eq (index $cell "cell_type") "markdown" -}} - {{- $source := index $cell "source" -}} - {{- $sourceContent := (cond (reflect.IsSlice $source) (delimit $source "") $source) -}} - {{- $sourceContent | $page.RenderString -}} + {{- $source := index $cell "source" }} + {{- $sourceContent := (cond (reflect.IsSlice $source) (delimit $source "") $source) }} +{{ (printf "\n%s\n" $sourceContent) | safeHTML }} {{- end -}} {{- end -}} {{- end -}}