File tree Expand file tree Collapse file tree 1 file changed +8
-13
lines changed
Expand file tree Collapse file tree 1 file changed +8
-13
lines changed Original file line number Diff line number Diff line change 11package payloads
22
33import (
4+ "strings"
5+
46 "github.com/davecgh/go-spew/spew"
57 "github.com/gomarkdown/markdown"
68)
79
810// NewDumpPayload creates a new Dump Payload
911func 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}
You can’t perform that action at this time.
0 commit comments