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 1
1
package payloads
2
2
3
3
import (
4
+ "strings"
5
+
4
6
"github.com/davecgh/go-spew/spew"
5
7
"github.com/gomarkdown/markdown"
6
8
)
7
9
8
10
// NewDumpPayload creates a new Dump Payload
9
11
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 ```" )
22
13
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 , "" )
24
19
}
You can’t perform that action at this time.
0 commit comments