Skip to content

Commit

Permalink
added prefix control to json helper
Browse files Browse the repository at this point in the history
  • Loading branch information
matryer committed Aug 4, 2024
1 parent 776ad29 commit 426f367
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions render/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ func Render(template string, def parser.Definition, params map[string]interface{
return s, nil
}

func toJSONHelper(v interface{}) (template.HTML, error) {
b, err := json.MarshalIndent(v, "", "\t")
func toJSONHelper(v interface{}, prefix, indent string) (template.HTML, error) {
if indent == "" {
indent = "\t"
}
b, err := json.MarshalIndent(v, prefix, indent)
if err != nil {
return "", err
}
Expand Down

0 comments on commit 426f367

Please sign in to comment.