From f95835469c897f2aec34599d231e5159bf08f105 Mon Sep 17 00:00:00 2001
From: Philipp <81698819+PhilippReinke@users.noreply.github.com>
Date: Fri, 22 Apr 2022 11:16:04 +0200
Subject: [PATCH] fix: remove double collapse for codeboxes (#179)
This fixes a bug where if you used the code macro the renderer would create
an additional expand macro if the collapse option was set. This led to
the code section being collapsiable twice.
Co-authored-by: Philipp Reinke
---
pkg/mark/stdlib/stdlib.go | 7 -------
pkg/mark/testdata/codes.html | 14 --------------
2 files changed, 21 deletions(-)
diff --git a/pkg/mark/stdlib/stdlib.go b/pkg/mark/stdlib/stdlib.go
index 463d638..f1bc132 100644
--- a/pkg/mark/stdlib/stdlib.go
+++ b/pkg/mark/stdlib/stdlib.go
@@ -106,10 +106,6 @@ func templates(api *confluence.API) (*template.Template, error) {
// This template is used for rendering code in ```
`ac:code`: text(
- `{{ if .Collapse }}{{printf "\n"}}`,
- `{{ if .Title }}{{ .Title }}{{printf "\n"}}{{ end }}`,
- `{{printf "\n"}}{{ end }}`,
-
`{{printf "\n"}}`,
/**/ `{{ if eq .Language "mermaid" }}true{{printf "\n"}}{{ else }}`,
/**/ `{{ .Language }}{{printf "\n"}}{{ end }}`,
@@ -117,9 +113,6 @@ func templates(api *confluence.API) (*template.Template, error) {
/**/ `{{ if .Title }}{{ .Title }}{{printf "\n"}}{{ end }}`,
/**/ `{{printf "\n"}}`,
`{{printf "\n"}}`,
-
- `{{ if .Collapse }}{{printf "\n"}}`,
- `{{printf "\n"}}{{ end }}`,
),
`ac:status`: text(
diff --git a/pkg/mark/testdata/codes.html b/pkg/mark/testdata/codes.html
index 4a1f879..ef0f80c 100644
--- a/pkg/mark/testdata/codes.html
+++ b/pkg/mark/testdata/codes.html
@@ -34,26 +34,17 @@ text 2
A b c
-
-A b c
-
bash
true
A b c
-
-
-
-
c
true
-
-
true
false
@@ -63,9 +54,6 @@ text 2
B-->D;
C-->D;]]>
-
-my mermaid graph
-
true
true
@@ -76,8 +64,6 @@ text 2
B-->D;
C-->D;]]>
-
-
true
false