Skip to content

Commit 57231f7

Browse files
committed
Migrate from generic styles to using Tailwind classes, implement dark mode background color
1 parent 6e49792 commit 57231f7

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

payloads/DumpPayload.go

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
package payloads
22

33
import (
4+
"strings"
5+
46
"github.com/davecgh/go-spew/spew"
57
"github.com/gomarkdown/markdown"
68
)
79

810
// NewDumpPayload creates a new Dump Payload
911
func NewDumpPayload(value interface{}) Payload {
10-
style := `
11-
<style>
12-
.go-dump pre {
13-
position:relative;
14-
overflow-x: auto;
15-
width: 100%;
16-
padding: 10px 10px;
17-
height: auto;
18-
background-color: #f3f3f3;
19-
}
20-
</style>`
21-
md := []byte("``` \n"+spew.Sdump(value)+"\n```")
12+
md := []byte("``` \n" + spew.Sdump(value) + "\n```")
2213
output := markdown.ToHTML(md, nil, nil)
23-
return NewCustomPayload(style+`<div class="go-dump">`+string(output) + "</div>", "")
14+
styledOutput := strings.Replace(string(output), "<pre><code>", strings.Join([]string{
15+
`<pre class="relative overflow-x-auto w-full p-5 h-auto bg-gray-100 dark:bg-gray-800">`,
16+
`<code class="h-auto">`,
17+
}, ""), 1)
18+
return NewCustomPayload(styledOutput, "")
2419
}

0 commit comments

Comments
 (0)